resolve generic services in Windsor?

30 views
Skip to first unread message

Scott_M

unread,
Oct 3, 2015, 1:08:01 AM10/3/15
to Castle Project Users
Is there a good way to resolve generic services using Windsor?  For example, I would like to resolve all services that implement IFoo<T> where T  : class, Bar.

thanks

scott


John Strzempa

unread,
May 13, 2016, 3:55:42 PM5/13/16
to Castle Project Users
I did something like this

<component id="MyComponent" service="MyNamespace.IRepository`1[[MyClass, __Code]], __Code" type="MyClassRepository, __Code"  />



Everytime IRepository<MyClass> is used, it uses the class MyClassRepository. __Code is whatever the assembly is for you class. In my case it was in ASP.Net App_Code folder.
Reply all
Reply to author
Forward
0 new messages