The following should to it
container.Register(
Component.For(typeof(IFoo<>))
.ImplementedBy(typeof(Foo<>))
);
Question
Is there a fluent way of writing the following:
var someTypes = GetType()
.Assembly
.GetTypes()
.Where(x => someFilter == true);
foreach(var someType in someTypes)
{
var genericInterface = typeof(IFoo<>).MakeGenericType(someType);
var genericImplementation = typeof(Foo<>).MakeGenericType(someType);
container.Register(
Component.For(genericInterface)
.ImplementedBy(genericImplementation));
}
Solution 2
The following should to it
container.Register(
Component.For(typeof(IFoo<>))
.ImplementedBy(typeof(Foo<>))
);
OTHER TIPS
a IGenericServiceStrategy
is what you're after (on top of what @maxlego said, which is correct)
See this for details and example.