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