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