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