コード例 #1
0
        public TestMPWAAspAbpDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <TestMPWAAspAbpDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            TestMPWAAspAbpDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TestMPWAAspAbpConsts.ConnectionStringName));

            return(new TestMPWAAspAbpDbContext(builder.Options));
        }
コード例 #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <TestMPWAAspAbpDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 TestMPWAAspAbpDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 TestMPWAAspAbpDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }