Пример #1
0
        public virtual void Insert(T entity)
        {
            try
            {
                if (entity == null)
                {
                    throw new ArgumentNullException(nameof(entity));
                }

                _context.Set <T>().Add(entity);
                _context.SaveChangesAsync();
            }
            catch (Exception dbEx)
            {
                throw new Exception(dbEx.Message);
            }
        }
 private DbSet <T> Set()
 => _context.Set <T>();