protected Repository(EscolaContext db) { Db = db; DbSet = db.Set <TEntity>(); DbSet.AsNoTracking(); }
public bool Deletar(TEntity entity) { if (entity != null) { var entry = Db.Entry(entity); if (entry.State == EntityState.Detached) { DbSet.Attach(entity); } Db.Set <TEntity>().Remove(entity); return(true); } return(false); }
public void Adicionar(TEntity obj) { _escolaContext.Set <TEntity>().Add(obj); _escolaContext.SaveChanges(); }
public void Adicionar(TEntity obj) { _ctx.Set <TEntity>().Add(obj); }
public RepositorioGenerico() { _context = new EscolaContext(); tabela = _context.Set <T>(); }
public RepositorioCompra() { _context = new EscolaContext(); tabela = _context.Set <Compra>(); }
public async Task <IList <TEntity> > CustomFind(Expression <Func <TEntity, bool> > where) => await _dbContext.Set <TEntity>().Where(where).ToListAsync();
public Repository(EscolaContext context) { Db = context; DbSet = Db.Set <TEntity>(); }