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