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