Exemple #1
0
        public CatalogContextFactory()
        {
            var contextOptions = new DbContextOptionsBuilder <CatalogContext>()
                                 .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                 .EnableSensitiveDataLogging()
                                 .Options;

            EnsureCreation(contextOptions);
            ContextInstance = new TestCatalogContext(contextOptions);
            GenreMapper     = new GenreMapper();
            ArtistMapper    = new ArtistMapper();
            ItemMapper      = new ItemMapper(ArtistMapper, GenreMapper);
        }
Exemple #2
0
 private void EnsureCreation(DbContextOptions <CatalogContext> contextOptions)
 {
     using var context = new TestCatalogContext(contextOptions);
     context.Database.EnsureCreated();
 }