示例#1
0
 public RepositoryBase(IDataBaseFactory Factory)
 {
     ctx   = Factory.DataContext;
     dbset = ctx.Set <T>();
 }
示例#2
0
 public Repository(Model1 db)
 {
     this.db    = db;
     this.table = db.Set <T>();
 }
示例#3
0
 public void UpdateEntity(T entity)
 {
     db.Set <T>().AddOrUpdate(entity);
     db.SaveChanges();
 }
示例#4
0
 public BaseRepository()
 {
     db    = new Model1();
     dbSet = db.Set <T>();
 }
示例#5
0
 public Repository()
 {
     this.db    = new Model1();
     this.table = db.Set <T>();
 }
示例#6
0
        public List <User> List()
        {
            Model1 ctx = new Model1();

            return(ctx.Set <User>().ToList());
        }
示例#7
0
        public virtual List <Leave> GetByName(string tj)
        {
            Model1 db = new Model1();

            return(db.Set <Leave>().Where(x => x.User.UserName == tj).ToList());
        }
示例#8
0
 public void Create(T item)
 {
     db.Set <T>().Add(item);
 }
示例#9
0
        public Comment Find(int id)
        {
            Model1 ctx = new Model1();

            return(ctx.Set <Comment>().Find(id));
        }
 public GenericRepository(Model1 context)
 {
     this.context = context;
     this.dbSet   = context.Set <ExampleDataModelo>();
 }
示例#11
0
 public IDbSet <T> DbSet()
 {
     return(_dbContext.Set <T>());
 }
示例#12
0
 public virtual List <T> GetAll()
 {
     return(db.Set <T>().ToList());
 }
示例#13
0
 public Repository()
 {
     db    = new Model1();
     table = db.Set <T>();
 }
示例#14
0
 public BaseRepository(Model1 db)
 {
     this.db = db;
     dbSet   = db.Set <T>();
 }
示例#15
0
 public BaseRepository()
 {
     dbSet = dbcontext.Set <TEntity>();//构造一个实体集
 }
示例#16
0
        public List <Comment> List()
        {
            Model1 ctx = new Model1();

            return(ctx.Set <Comment>().ToList());
        }
示例#17
0
        public User Find(int id)
        {
            Model1 ctx = new Model1();

            return(ctx.Set <User>().Find(id));
        }
示例#18
0
 public RepositoryBase(Model1 _ctx)
 {
     _set = _ctx.Set <TEntity>();
 }
示例#19
0
        public virtual List <Leave> GetByother(string tj)
        {
            Model1 db = new Model1();

            return(db.Set <Leave>().Where(x => x.LeaveOver != tj).ToList());
        }
示例#20
0
        public virtual int Count(Expression <Func <T, bool> > predicate)

        {
            return(dbEF.Set <T>().AsNoTracking().Count(predicate));
        }
示例#21
0
        public virtual List <Leave> GetBySomeother(string tj, string tj2)
        {
            Model1 db = new Model1();

            return(db.Set <Leave>().Where(x => x.LeaveOver == tj && x.Leave_Condition == tj2).ToList());
        }
示例#22
0
 public GenericRepository(Model1 context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }