Example #1
0
        public TestDownloadDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <TestDownloadDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            TestDownloadDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TestDownloadConsts.ConnectionStringName));

            return(new TestDownloadDbContext(builder.Options));
        }
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <TestDownloadDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 TestDownloadDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 TestDownloadDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }