コード例 #1
0
 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());
     }
 }
コード例 #2
0
 public T QueryOne <T>(Expression <Func <T, bool> > filter)
     where T : class
 {
     using (var context = new EntityFrameworkCoreDbContext()) {
         return(context.Set <T>().SingleOrDefault(filter));
     }
 }
コード例 #3
0
 public void InserMany <T>(IEnumerable <T> entities)
     where T : class
 {
     using (var context = new EntityFrameworkCoreDbContext()) {
         context.Set <T>().AddRange(entities);
         context.SaveChanges();
     }
 }
コード例 #4
0
 public void InsertOne <T>(T entity)
     where T : class
 {
     using (var context = new EntityFrameworkCoreDbContext()) {
         context.Set <T>().Add(entity);
         context.SaveChanges();
     }
 }
コード例 #5
0
 public DevicesController(EntityFrameworkCoreDbContext context)
 {
     _context = context;
 }
コード例 #6
0
 public GatewaysController(EntityFrameworkCoreDbContext context)
 {
     _context = context;
 }