public KfDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <KfDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); KfDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AbpZeroTemplateConsts.ConnectionStringKf)); return(new KfDbContext(builder.Options)); }
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 )); } }); } }