public virtual TEntity Adicionar(TEntity entity) { _dbContext.Set <TEntity>().Add(entity); _dbContext.SaveChanges(); return(entity); }
public async Task <TEntity> AddAsync(TEntity entity) { await _context.Set <TEntity>().AddAsync(entity); await _context.SaveChangesAsync(); return(entity); }
public Repository(ClienteContext Context) { this.Context = Context; this.Context.Database.Migrate(); Db = Context.Set <T>(); }
} //constructor public virtual T Add(T entity) { _context.Set <T>().Add(entity); _context.SaveChanges(); return(entity); } //Add
public TipoRepository(ClienteContext Context) : base(Context) { Db = Context.Set <Tipo>(); }
public Repository(ClienteContext context) { Db = context; DbSet = Db.Set <TEntity>(); }
//o virtual serve para aplicar polimorfismo, o método será sobescrito public virtual TEntity Adicionar(TEntity entity) { _dbContext.Set <TEntity>().Add(entity); //adicionando ao banco _dbContext.SaveChanges(); // salvando no banco return(entity); }
public Repository(ClienteContext db) { Db = db; DbSet = Db.Set <TEntity>(); }
public virtual T Adicionar(T entity) { _dbcontext.Set <T>().Add(entity); _dbcontext.SaveChanges(); return(entity); }
public Repository(ClienteContext context) { _context = context; _entities = context.Set <TEntity>(); }
public BaseRepository(ClienteContext context, IVariablesToken variables) { _context = context; _variables = variables; DbSet = _context.Set <TEntity>(); }
public virtual TEntity Adicionar(TEntity entity) { _dbContext.Set <TEntity>().Add(entity); _dbContext.SaveChanges(); // persistencia de dados... return(entity); }