开发者

Retrieve DLL from directory with Windsor Castle

I currently have a "PlugInFolder" folder where I want to copy my custom plug-in as DLL Library. Every plug-in implements my "IPlugIn" interface.

I want to retrieve them at runtime with Windsor Castle.

I've tried something like this without results:

CastleContainer.Instance
       .Install(
        FromAssembly.InDirectory(new AssemblyFilter("PlugInFolder"))
         );

      CastleContainer.Instance.Register(Component.For<IPlugIn>());


       IPlugIn[] plugIn= CastleContainer.Instance.ResolveAll<IPlugIn>();  

I receive this error:

Type Ima开发者_StackOverflow中文版geEditorInterfaces.IPlugIn is abstract.
As such, it is not possible to instansiate it as implementation of service ImageEditorInterfaces.IPlugIn.


Try something like this:

container.Register(AllTypes
    .FromAssemblyInDirectory(new AssemblyFilter("PlugInFolder"))
    .BasedOn<IPlugIn>());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜