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