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