public IQueryable <T> FindById(Expression <Func <T, bool> > predicate) { using (StoreDataContext dataContext = new StoreDataContext()) { return(dataContext.Set <T>().Where(predicate)); } }
public T Get(Expression <Func <T, bool> > predicate) { using (StoreDataContext dataContext = new StoreDataContext()) { return(dataContext.Set <T>().Where(predicate).FirstOrDefault()); } }
public virtual async Task <IList <T> > GetAllAsync(string userId) { using (StoreDataContext dataContext = new StoreDataContext()) { var results = await dataContext.Set <T>().ToListAsync(); return(results); } }
public virtual async Task <T> GetAsync(Expression <Func <T, bool> > predicate) { using (StoreDataContext dataContext = new StoreDataContext()) { var result = await dataContext.Set <T>().Where(predicate).FirstOrDefaultAsync(); return(result); } }
public virtual async Task CreateAsync(T entity) { using (StoreDataContext dataContext = new StoreDataContext()) { entity.CreatedDateTime = DateTime.Now; entity.ModifyDateTime = DateTime.Now; dataContext.Set <T>().Add(entity); await dataContext.SaveChangesAsync(); } }
public void Create(T entity) { using (StoreDataContext dataContext = new StoreDataContext()) { entity.CreatedDateTime = DateTime.Now; entity.ModifyDateTime = DateTime.Now; dataContext.Set <T>().Add(entity); dataContext.SaveChanges(); } }
public Repository(StoreDataContext storeDataContext, IConfiguration configuration) { _storeDataContext = storeDataContext; dataset = _storeDataContext.Set <T>(); _config = configuration; }
public ProdutoRepositoryEF(StoreDataContext ctx) : base(ctx) { _dbset = ctx.Set <Produto>(); }
public RepositoryEF(StoreDataContext context) { _context = context; _db = _context.Set <TEntity>(); }
public void Add(T entity) { _ctx.Set <T>().Add(entity); // _ctx.SaveChanges(); }
public void Add(T entity) { _ctx.Set <T>().Add(entity); save(); }
public IEnumerable <T> Get() { _table = _context.Set <T>(); return(_table.AsNoTracking().ToList()); }
public GenericRepository(StoreDataContext _context) { this._context = _context; _table = _context.Set <T>(); }
public virtual async Task <IEnumerable <TType> > Get() { return(await _context.Set <TType>().AsNoTracking().ToListAsync()); }
public EFRepository(StoreDataContext ctx) { _ctx = ctx; _dbSet = _ctx.Set <TEntity>(); }
public T Obter(int id) { return(contexto.Set <T>().Find(id)); }
public RepositoryEF(StoreDataContext ctx) { _ctx = ctx; _db = ctx.Set <TEntity>(); }
public T Obter(int id) { return(_ctx.Set <T>().Find(id)); }