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

            TestProjectDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TestProjectConsts.ConnectionStringName));

            return(new TestProjectDbContext(builder.Options));
        }
예제 #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <TestProjectDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 TestProjectDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 TestProjectDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }