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