Esempio n. 1
0
        public BookShopContextFactory()
        {
            var contextOptions = new
                                 DbContextOptionsBuilder <BookShopContext>()
                                 .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                 .EnableSensitiveDataLogging()
                                 .Options;

            EnsureCreation(contextOptions);
            ContextInstance = new TestBookShopContext(contextOptions);
            GenreMapper     = new GenreMapper(); ArtistMapper = new AuthorMapper();
            BookMapper      = new BookMapper(ArtistMapper, GenreMapper);
        }
Esempio n. 2
0
 private void EnsureCreation(DbContextOptions <BookShopContext>
                             contextOptions)
 {
     using var context = new TestBookShopContext(contextOptions);
     context.Database.EnsureCreated();
 }