public IReadOnlyList <T> FindMany <T>(Expression <Func <T, bool> > filter)
     where T : class
 {
     using (var context = new EntityFrameworkCoreDbContext()) {
         return(context.Set <T>().Where(filter).ToList());
     }
 }
 public T QueryOne <T>(Expression <Func <T, bool> > filter)
     where T : class
 {
     using (var context = new EntityFrameworkCoreDbContext()) {
         return(context.Set <T>().SingleOrDefault(filter));
     }
 }
 public void InserMany <T>(IEnumerable <T> entities)
     where T : class
 {
     using (var context = new EntityFrameworkCoreDbContext()) {
         context.Set <T>().AddRange(entities);
         context.SaveChanges();
     }
 }
 public void InsertOne <T>(T entity)
     where T : class
 {
     using (var context = new EntityFrameworkCoreDbContext()) {
         context.Set <T>().Add(entity);
         context.SaveChanges();
     }
 }
 public DevicesController(EntityFrameworkCoreDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 6
0
 public GatewaysController(EntityFrameworkCoreDbContext context)
 {
     _context = context;
 }