예제 #1
0
 private void EnsureCreation(DbContextOptions <CatalogContext> contextOptions)
 {
     using (var context = new TestCatalogContext(contextOptions))
     {
         context.Database.EnsureCreated();
     }
 }
예제 #2
0
        public CatalogDataContextFactory()
        {
            ContextOptions = new DbContextOptionsBuilder <CatalogContext>()
                             .UseInMemoryDatabase(Guid.NewGuid().ToString())
                             .EnableSensitiveDataLogging()
                             .Options;

            EnsureCreation(ContextOptions);
            ContextInstance = new TestCatalogContext(ContextOptions);
        }