Esempio n. 1
0
 /// <summary>
 /// 获取集合
 /// </summary>
 /// <param name="whereLambda"></param>
 /// <returns></returns>
 public IQueryable <T> ListModels(Expression <Func <T, bool> > whereLambda)
 {
     return(db.Set <T>().Where(whereLambda));
 }
Esempio n. 2
0
 public IQueryable <T> LoadEntities(System.Linq.Expressions.Expression <Func <T, bool> > whereLambda)
 {
     return(db.Set <T>().Where <T>(whereLambda));
 }
Esempio n. 3
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <returns></returns>
        public IQueryable <T> Get()
        {
            DbContext db = GetDbContext();

            return(db.Set <T>());
        }
Esempio n. 4
0
 public T Add(T entity)
 {
     // throw new NotImplementedException();
     _Db.Set <T>().Add(entity);
     return(entity);
 }
Esempio n. 5
0
 public Repository(DbContext context)
 {
     Context    = context;
     this.dbSet = Context.Set <TEntity>();
 }