C#, DI, IOC using Castle Windsor

Posted by humblecoder on Stack Overflow See other posts from Stack Overflow or by humblecoder
Published on 2010-05-25T10:25:39Z Indexed on 2010/05/25 10:31 UTC
Read the original article Hit count: 325

Filed under:
|

Hi! Am working on a design of a project. I would like to move the implementation away hence to decouple am using interfaces.

interface IFoo { void Bar(); void Baz(); }

The assemblies which implemented the above interface would be drop in some predefined location say "C:\Plugins" for eg: project: A class A : IFoo { }

when compiled produces A.dll

project: B class A : IFoo { }

when compiled produced B.dll

Now I would like to provide a feature in my application to enable end use to configure the assembly to be loaded in the database.say C:\Plugins\A.dll or C:\Plugins\B.dll

How it can be achieved using Castle Windsor. container.AddComponent("identifier",load assembly from specified location as configured in DB);

I would like to do something like this: IFoo foo =container.Resolve("identifier");

foo.Bar(); //invoke method. Any hint would be highly appreciated.

Thanks,

Hamed.

© Stack Overflow or respective owner

Related posts about c#

Related posts about windsor