Skip to content

Commit

Permalink
mongo settings support
Browse files Browse the repository at this point in the history
  • Loading branch information
Modest-as committed Jan 7, 2022
1 parent aea2a3e commit 65c0c4d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions EventSauce.MongoDB/MongoDBSauceStoreFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,28 @@ namespace EventSauce.MongoDB
public class MongoDBSauceStoreFactory
{
private readonly Assembly[] _assemblies;
private readonly string _connectionString;
private readonly MongoClientSettings _clientSettings;
private readonly string _database;
private readonly string _collection;

public MongoDBSauceStoreFactory(
Assembly[] assemblies,
string connectionString,
string database) : this(assemblies, connectionString, database, "events") { }
string database) : this(assemblies, MongoClientSettings.FromConnectionString(connectionString), database, "events") { }

public MongoDBSauceStoreFactory(
Assembly[] assemblies,
string connectionString,
MongoClientSettings clientSettings,
string database) : this(assemblies, clientSettings, database, "events") { }

public MongoDBSauceStoreFactory(
Assembly[] assemblies,
MongoClientSettings clientSettings,
string database,
string collection)
{
_assemblies = assemblies;
_connectionString = connectionString;
_clientSettings = clientSettings;
_database = database;
_collection = collection;

Expand Down Expand Up @@ -93,7 +98,7 @@ public ISauceStore Create()

private IMongoCollection<BsonDocument> CreateCollection()
{
var client = new MongoClient(_connectionString);
var client = new MongoClient(_clientSettings);

var database = client.GetDatabase(_database);

Expand Down

0 comments on commit 65c0c4d

Please sign in to comment.