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