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