public async System.Threading.Tasks.Task <T> Add(T entity)
        {
            _ctx.Set <T>().Add(entity);
            await _ctx.SaveChangesAsync();

            return(entity);
        }
Пример #2
0
        private IQueryable <T> InsializeQuery <T>(params Expression <Func <T, object> >[] includes) where T : class
        {
            var query = _context.Set <T>().AsQueryable();

            if (includes.Any())
            {
                foreach (var include in includes)
                {
                    query = query.Include(include);
                }
            }
            return(query);
        }
Пример #3
0
 public GenericRepository(DatingAppContext context)
 {
     this._context = context;
     _entitySet    = _context.Set <TEntity> ();
 }
Пример #4
0
 public SaveRepository(DatingAppContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <T>();
 }
Пример #5
0
 public async Task <List <User> > GetAllusers()
 {
     return(await _context.Set <User>().Include(u => u.Group).ToListAsync());
 }