/// <summary> /// Return the entity based on the primery key provided. /// </summary> /// <param name="key">Primary key of the entity</param> /// <returns>Entity if exists with the primary key provied else null</returns> public Entity GetByKey(object key) { var entity = _evolentDBContext.Set <Entity>().Find(key); if (entity != null) { _evolentDBContext.Entry(entity).State = EntityState.Detached; } return(entity); }
public GenericRepository(evolentDBContext _dbContext) { _evolentDBContext = _dbContext; _dbSet = _evolentDBContext.Set <Entity>(); }