コード例 #1
0
 public async Task <T> GetOne(Guid id)
 {
     using (var db = new PostgresContext())
     {
         return(await db.Set <T>().FindAsync(id));
     }
 }
コード例 #2
0
 public async Task <List <T> > GetAll()
 {
     using (var db = new PostgresContext())
     {
         return(await db.Set <T>().ToListAsync());
     }
 }
コード例 #3
0
 public async Task <int> Update(T entity)
 {
     using (var db = new PostgresContext())
     {
         db.Set <T>();
         db.Update(entity);
         return(await db.SaveChangesAsync());
     }
 }
コード例 #4
0
 public UserRepository(PostgresContext db)
 {
     this.context = db;
     this.users   = db.Set <User>();
 }
コード例 #5
0
 public IQueryable <TEntity> GetAll()
 {
     return(_postgresContext.Set <TEntity>().AsNoTracking());
 }
コード例 #6
0
 protected RepositoryBase(PostgresContext storeContext)
 {
     _storeContext = storeContext;
     _dbSet        = _storeContext.Set <T>();
 }
コード例 #7
0
 public ContestParticipantRepository(PostgresContext db)
 {
     this.context             = db;
     this.contestParticipants = db.Set <ContestParticipant>();
 }
コード例 #8
0
 public GenericRepository(PostgresContext context)
 {
     _context = context;
     dataset  = _context.Set <T>();
 }
コード例 #9
0
 public SerialNumberRepository(PostgresContext db)
 {
     this.context       = db;
     this.serialNumbers = db.Set <SerialNumber>();
 }