0

Im new to Autofac and finding myself repeating a lot of this....

builder.RegisterType<ConcreteService<EntityA>>().As<IService<EntityA>>();
builder.RegisterType<ConcreteService<EntityB>>().As<IService<EntityB>>();

EntityA, EntityB, EntityC and so on.. all inherit from EntityBase, so i want to instruct Autofac to always use ConcreteService<x> when it needs to create an implementation of IService<x> as long as x inherits from EntityBase

I am aware that the AssemblyScanner in Autofac may be able to help with this, although i am struggling to find documentation that goes far enough into it.

Any pointers appreciated.

1

1 Answer 1

1

I think the answer to this question (stackoverflow) may also answer your question.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.