Is there a better way to express this fluent registration in Windsor?
Basically I would like a way to express: Find all classes with base class AbstractDataService<>
and resolve them by their in开发者_开发问答terface and not by their base class.
container.Register(AllTypes.Pick()
.FromAssembly(typeof(AbstractDataService<>).Assembly)
.If(Component.IsInSameNamespaceAs(typeof(AbstractDataService<>)))
.WithService.FirstInterface());
Is it possible?
Maybe you could use .BasedOn(...)?
You can create intermediate variables. But...I'm not really sure what the real problem is. Complex things look complex. This is reality.
精彩评论