Beispiel #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));
 }
Beispiel #2
0
 public IQueryable <T> LoadEntities(System.Linq.Expressions.Expression <Func <T, bool> > whereLambda)
 {
     return(db.Set <T>().Where <T>(whereLambda));
 }
Beispiel #3
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <returns></returns>
        public IQueryable <T> Get()
        {
            DbContext db = GetDbContext();

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