generic-repository

IRepository and Unit Of Work vs Eager Loading

Deadly 提交于 2019-12-06 08:50:35
问题 I know having a Unit Of Work is having an abstraction on top of an abstraction ( DbContext ) and surely that is an anti-pattern, or at least is not necessary. I have the following problem: I have a generic IRepository like so: public interface IGenericRepository<TEntity> where TEntity : class { IEnumerable<TEntity> Get( Expression<Func<TEntity, bool>> filter = null, Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null, string includeProperties = ""); TEntity GetByID(object id)

IRepository and Unit Of Work vs Eager Loading

江枫思渺然 提交于 2019-12-04 11:39:48
I know having a Unit Of Work is having an abstraction on top of an abstraction ( DbContext ) and surely that is an anti-pattern, or at least is not necessary. I have the following problem: I have a generic IRepository like so: public interface IGenericRepository<TEntity> where TEntity : class { IEnumerable<TEntity> Get( Expression<Func<TEntity, bool>> filter = null, Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null, string includeProperties = ""); TEntity GetByID(object id); void Insert(TEntity entity); void Delete(object id); void Delete(TEntity entityToDelete); void Update

Generic Repository or Specific Repository for each entity?

夙愿已清 提交于 2019-11-26 03:27:05
问题 Background At the company I work for I have been ordered to update an old MVC app and implement a repository pattern for a SQL database. I have created the context of the database using Entity Framework Database-First and got 23 entities. The first question Do I need to create a repository for each entity or implement a generic repository for the context? I\'m asking this because I have found following while searching internet: One repository per domain You should think of a repository as a