I am writing a T4 template for repositories.
Say we have Customers/Orders/Products tables. We then have CustomerRepo, OrdersRepo, and ProductsRepo.
Is it a good practice to have a generic repo for all of them?
public partial class Repository
{
private IContext context;
public Repository()
{
_Product = new ProductRepo();
_Customer = new CustomerRepo();
}
public Repository(IContext context)
{
this.context = context;
_Product = new ProductRepo(context);
_Customer = new CustomerRepo(context);
}
private ProductRepo _Product;
public ProductRepo Product {
get { return _Product; }
}
// Product
private CustomerRepo _Customer;
public CustomerRepo Customer {
get { return _Customer; }
}
// Customer
}