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