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

            HealthBackDbContextConfigurer.Configure(builder, configuration.GetConnectionString(HealthBackConsts.ConnectionStringName));

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