public CYDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <CYDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            CYDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AbpZeroTemplateConsts.ConnectionStringCY));

            return(new CYDbContext(builder.Options));
        }
Пример #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <AbpZeroTemplateDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 AbpZeroTemplateDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 AbpZeroTemplateDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
         Configuration.Modules.AbpEfCore().AddDbContext <CYDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 CYDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 CYDbContextConfigurer.Configure(options.DbContextOptions, _appConfiguration.GetConnectionString(
                                                     AbpZeroTemplateConsts.ConnectionStringCY
                                                     ));
             }
         });
         Configuration.Modules.AbpEfCore().AddDbContext <GroupMessageDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 GroupMessageDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 GroupMessageDbContextConfigurer.Configure(options.DbContextOptions, _appConfiguration.GetConnectionString(
                                                               AbpZeroTemplateConsts.ConnectionStringGroupMessage
                                                               ));
             }
         });
         Configuration.Modules.AbpEfCore().AddDbContext <KfDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 KfDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 KfDbContextConfigurer.Configure(options.DbContextOptions, _appConfiguration.GetConnectionString(
                                                     AbpZeroTemplateConsts.ConnectionStringKf
                                                     ));
             }
         });
     }
 }