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