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