Пример #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app,
            IWebHostEnvironment env,
            BudgetDataDbContext budgetDataDbContext,
            ComprehensiveDataDbContext comprehensiveDataDbContext)
        {
            // creates or apply migrations to the databases
            // remove this if there is an alternative migration strategy
            budgetDataDbContext.Database.Migrate();
            comprehensiveDataDbContext.Database.Migrate();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Пример #2
0
        public async Task InitializeAsync()
        {
            using var context = new ComprehensiveDataDbContext(DbContextOptions);
            await context.Database.EnsureDeletedAsync();

            await context.Database.MigrateAsync();
        }
Пример #3
0
 public async Task DisposeAsync()
 {
     using var context = new ComprehensiveDataDbContext(DbContextOptions);
     await context.Database.EnsureDeletedAsync();
 }
 public void CanCreateAndDropDatabase()
 {
     using var context = new ComprehensiveDataDbContext(DbContextOptions);
 }
Пример #5
0
 public ComprehensiveDataWrapper(
     ComprehensiveDataDbContext comprehensiveDataDbContext)
 {
     ComprehensiveDataDbContext = comprehensiveDataDbContext;
 }