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