开发者

Autowiring collections with IoC

开发者 https://www.devze.com 2022-12-27 00:24 出处:网络
Anyone know if there开发者_开发知识库 exists any IoC container that can handle this: Given: ISomeInterfce<T> where T : Entity

Anyone know if there开发者_开发知识库 exists any IoC container that can handle this:

Given:

ISomeInterfce<T> where T : Entity

Impl1 : ISomeInterfce<Entity1>

Impl2 : ISomeInterfce<Entity1>

Impl3 : ISomeInterfce<Entity2>

Impl4 : ISomeInterfce<Entity2>

I want to be able to auto wire my system and be able to resolve like this

IoC.ResolveAll(typeof(ISomeInterfce<Entity1>)) 

and get a collection back of all implementations of ISomeInterfce<Entity1>


Autofac (my favourite IoC container) supports this feature, check out: http://code.google.com/p/autofac/wiki/Collections for details.

0

精彩评论

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