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