Exemplo n.º 1
0
 public IQueryable <T> All()
 {
     return(_context.Set <T>().AsQueryable());
 }
Exemplo n.º 2
0
        public virtual void Add(T entity)
        {
            //EntityEntry dbEntityEntry = _context.Entry<T>(entity);
            //_context.Set<T>().Add(entity);

            _context.Set <T>().Add(entity);
            //_context.Add(entity);
            //if (entity == null)
            //{
            //    throw new ArgumentNullException("entity");
            //}

            //EntityEntry dbEntityEntry = _context.Entry<T>(entity);
            //if (dbEntityEntry.State != (EntityState)EntityState.Detached)
            //{
            //    dbEntityEntry.State = EntityState.Added;
            //}
            //else
            //{
            //    _context.Set<T>().Add(entity);
            //}
        }