0
我尝试注册一个通用类型Repository<T>
与接口IRepository<T>
其中T
是IEntity
。注册一个不同的通用类型作为扫描
builder.RegisterAssemblyTypes(assemblies)
.Where(t => typeof(IEntity).IsAssignableFrom(t))
.WithMetadata("Type", (t) => t)
.AsImplementedInterfaces()
.InstancePerLifetimeScope();
现在的问题是如何注册的每个IEntity
发现我的课
Repository<T>: IRepository<T> where T: IEntity