Beispiel #1
0
 public static void UpdateModel(List <Models.Book> books)
 {
     //var optionsBuilder = new DbContextOptionsBuilder();
     //optionsBuilder.UseSqlServer("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=MyStuff;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
     //optionsBuilder.UseLoggerFactory(MyConsoleLoggerFactory);
     using (var BookCtx = new MyStuffdbContext(new DbContextOptions <MyStuffdbContext>()))
     {
         BookCtx.FavoriteBooks.AddRange(books);
         //BookCtx.FavoriteBooks.UpdateRange(books);
         BookCtx.SaveChanges();
     }
 }
 public SqlProjectData(MyStuffdbContext context)
 {
     _context = context;
 }
Beispiel #3
0
 public SqlBookData(MyStuffdbContext context)
 {
     _context = context;
 }