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