我遵循存储库模式,我有一个类似的问题:
但是,我的基本存储库具有以下签名:
public abstract class Repository<C, T> : IRepository<T> where C : DbContext
where T : class, IEntity
{ }
目前在我的UoW中,我已经手动设置了每个存储库:
private ICustomerRepository customerRepository;
public ICustomerRepository Customers
{
get { return customerRepository?? (customerRepository= new CustomerRepository((IDatabaseFactory<MyDbContext>)databaseFactory)); }
}
有没有办法实现存储库工厂?