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