public MongoDbContext(string dbName, MongoClientSettings mongoClientSettings, Func <string> getUsernameFunc = null, bool setDictionaryConventionToArrayOfDocuments = false, IEnumerable <CustomMongoConnection> customConnections = null, IObjectSavePreprocessor objectPreprocessor = null) { this.dbName = dbName; this.GetUserNameFunc = getUsernameFunc; this.setDictionaryConventionToArrayOfDocuments = setDictionaryConventionToArrayOfDocuments; this.Database = GetDatabase(mongoClientSettings, dbName, setDictionaryConventionToArrayOfDocuments); if (customConnections != null) { this.customConnections.AddRange(customConnections); } this.objectPreprocessor = objectPreprocessor; }
public MongoDbContext(string dbName, string connectionString, Func <string> getUsernameFunc = null, bool setDictionaryConventionToArrayOfDocuments = false, IEnumerable <CustomMongoConnection> customConnections = null, IObjectSavePreprocessor objectPreprocessor = null) : this(dbName, MongoClientSettings.FromConnectionString(connectionString), getUsernameFunc, setDictionaryConventionToArrayOfDocuments, customConnections, objectPreprocessor) { }