public MongoDbOptionsExtension([CanBeNull] MongoDbOptionsExtension existing = null)
 {
     if (existing != null)
     {
         CopyOptions(existing);
     }
 }
 private void CopyOptions(MongoDbOptionsExtension existing)
 {
     _connectionString = existing.ConnectionString;
     _mongoClient      = existing.MongoClient;
     _mongoUrl         = existing.MongoUrl;
     _mongoClient      = existing.MongoClient;
 }
        private static DbContextOptionsBuilder SetupMongoDb([NotNull] DbContextOptionsBuilder optionsBuilder,
                                                            [NotNull] Action <MongoDbOptionsExtension> mongoDbOptionsExtensionAction,
                                                            [CanBeNull] Action <MongoDbContextOptionsBuilder> mongoDbOptionsAction)
        {
            MongoDbOptionsExtension extension = GetOrCreateExtension(optionsBuilder);

            mongoDbOptionsExtensionAction(extension);
            ((IDbContextOptionsBuilderInfrastructure)optionsBuilder).AddOrUpdateExtension(extension);

            ConfigureWarnings(optionsBuilder);

            mongoDbOptionsAction?.Invoke(new MongoDbContextOptionsBuilder(optionsBuilder));

            return(optionsBuilder);
        }