public JKDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <JKDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); JKDbContextConfigurer.Configure(builder, configuration.GetConnectionString(JKConsts.ConnectionStringName)); return(new JKDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <JKDbContext>(options => { if (options.ExistingConnection != null) { JKDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { JKDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }