Example #1
0
        public ERPContextFactory()
        {
            DbContextOptions <ERPContext> contextOptions = new DbContextOptionsBuilder <ERPContext>()
                                                           .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                                           .EnableSensitiveDataLogging()
                                                           .Options;

            EnsureCreation(contextOptions);
            ContextInstance = new TestERPContext(contextOptions);

            GenreMapper  = new GenreMapper();
            ArtistMapper = new ArtistMapper();
            ItemMapper   = new ItemMapper(ArtistMapper, GenreMapper);
        }
Example #2
0
 private void EnsureCreation(DbContextOptions <ERPContext> contextOptions)
 {
     using TestERPContext context = new TestERPContext(contextOptions);
     context.Database.EnsureCreated();
 }