Autofac Conventions for Generic Types

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.

Answers


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


Need Your Help

Multiple Table Update On (Hands On Table)

javascript jquery handsontable

I am using Handsone table on three seperate instances of tables. I declare them as you can see here. When I try to save them, I get the data from each of the tables. To my surprise, it

Are any implementations of Bloomier filters available?

java data-structures bloom-filter

I've come across quite a bit of theory regarding Bloomier filters but have had no luck digging up an actual implementation of them (no luck at github, sourcefoge, google, etc.). Does anyone know o...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.