42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using MongoDB.Driver;
|
|
using System;
|
|
|
|
namespace EnVisage.MongoDbMigration.DataAccess
|
|
{
|
|
public class MongoAccessorsContainer
|
|
{
|
|
#region Private Members
|
|
|
|
private IMongoDatabase _database = null;
|
|
|
|
private IMigrationsAccessor _migrationAccessor = null;
|
|
|
|
#endregion
|
|
|
|
#region Public Members
|
|
|
|
public IMigrationsAccessor MigrationAccessor
|
|
{
|
|
get
|
|
{
|
|
if (_migrationAccessor == null)
|
|
_migrationAccessor = new MigrationsAccessor(_database);
|
|
|
|
return _migrationAccessor;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
public MongoAccessorsContainer(string connectionString, string databaseName)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(connectionString))
|
|
throw new ArgumentNullException("connectionString");
|
|
|
|
if (string.IsNullOrWhiteSpace(databaseName))
|
|
throw new ArgumentNullException("databaseName");
|
|
|
|
_database = (new MongoClient(connectionString)).GetDatabase(databaseName);
|
|
}
|
|
}
|
|
} |