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