Exemplo n.º 1
0
 private void FirstCreateDbContext()
 {
     // Create new db and db file where selected
     _dbContext = new DataAccess.Data.DBioPhotoContext(_filePath);
     _dbContext.Database.EnsureCreated();
     _dbContext.SaveChanges();
     _dbContext.Dispose();
     _dbContext = null;
 }
Exemplo n.º 2
0
 private void CreateDbContext()
 {
     // Verify it's possible to create the dbcontext and there's database created, if creating first db, wait for it
     if (firstContextCreateThread != null && firstContextCreateThread.ThreadState == ThreadState.Running)
     {
         firstContextCreateThread.Join();
     }
     if (_dbContext != null)
     {
         _dbContext.SaveChanges();
         _dbContext.Dispose();
     }
     _dbContext = new DataAccess.Data.DBioPhotoContext(_filePath);
     _dbContext.Database.EnsureCreated();
     _dbContext.SaveChanges();
     _dbContext.Dispose();
 }