예제 #1
0
        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);
        }
예제 #2
0
        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();
        }
예제 #3
0
 public IQueryable <T> GetAllNoTracking()
 {
     return(dataContext.Set <T>().AsNoTracking());
 }
예제 #4
0
 protected RepositoryBase(IDbFactory dbFactory)
 {
     DbFactory = dbFactory;
     dbSet     = DbContext.Set <T>();
 }