I have an Interface IRepo <Entity>
. I have a generic implementation Repo<Entity>
.
Now i just do the following
Container.Register(AllTypes.FromAssemblyNamed("assemblyname").Pick() .WithService.DefaultInterface() .Configure(c => c.LifeStyle.PerWebRequest))
and register all the interface with respective implementations. This seems to work fine.
My Problem arises when i try to be more specific.
If i try to map IRepo<Person>
with Person being a class subclassing Entity with <UserRepo>
using
Container.Register(Component.For(IRepo<Person>
).ImplementedBy(UserRepo).LifeStyle.PerWebRequest);
这似乎并不可行。
我这样做的次序是,我登记这一具体执行情况,然后将所有接口装上并登记到大会的类型。
这似乎并不可行。