Is it possible to implement Unit of Work with Generic Repository if my application is having multiple contexts and each context referring to different database. If So? Could you please provide an example.Any help will be highly appreciated.
public class GenericRepository<TEntity> where TEntity : class
{
internal SchoolContext context;
internal DbSet<TEntity> dbSet;
public GenericRepository(SchoolContext context)
{
this.context = context;
this.dbSet = context.Set<TEntity>();
}
I am doing as above. My question is can I generalize the context to be able to use different contexts for the same GenericRepository Class.
Aucun commentaire:
Enregistrer un commentaire