コード例 #1
0
 public async Task <IEnumerable <TEntity> > GetAllAsync()
 {
     return(await _context
            .Set <TEntity>()
            .AsNoTracking()
            .ToListAsync()
            .ConfigureAwait(false));
 }
コード例 #2
0
ファイル: EntityService.cs プロジェクト: mathianasj/products
        public E Create(E entity)
        {
            try
            {
                E output = _context.Set <E>().Add(entity);
                _context.SaveChanges();

                return(output);
            } catch (DbUpdateException e)
            {
                CheckDbConstraintValidations(e, entity);

                throw e;
            } catch (Exception e)
            {
                throw e;
            }
        }