public virtual IQueryable <T> AllIncluding(params Expression <Func <T, object> >[] includeProperties) { IQueryable <T> query = DbContext.Set <T>(); foreach (var includeProperty in includeProperties) { query = query.Include(includeProperty); //It is for eagerly loading related entities. } return(query); }
private void SaveError(string message, string stackTrace, string method, string table) { SMSDbContext _dbContext = new SMSDbContext(); ErrorLog _error = new ErrorLog() { Message = message, DateLog = DateTime.Now, StackTrace = stackTrace, Method = method, Table = table }; _dbContext.Set <ErrorLog>().Add(_error); _dbContext.SaveChanges(); }
public IQueryable <T> GetAllNoTracking() { return(dataContext.Set <T>().AsNoTracking()); }
protected RepositoryBase(IDbFactory dbFactory) { DbFactory = dbFactory; dbSet = DbContext.Set <T>(); }