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