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>());
精彩评论