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