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