/// <summary> /// Creates a new instance of MigrationRunner /// </summary> /// <param name="url">MongoDb connection string</param> /// <param name="migrationAssembly">Assembly with migrations</param> public MigrationRunner(MongoUrl url, string migrationAssembly) { _dbMigrations = new DatabaseMigrations(url); _locator = new MigrationLocator(migrationAssembly, _dbMigrations.GetDatabase()); _migrationAssembly = migrationAssembly; }
/// <summary> /// Creates a new instance of <seealso cref="MigrationRunner" /> /// </summary> /// <param name="connectionString">The Mongo connection string in form of mongodb://host:port/database</param> /// <param name="migrationAssembly">The target assembly containing migrations.</param> /// <param name="logger">Logger for logging</param> public MigrationRunner(string connectionString, Assembly migrationAssembly, ILogger logger = null) { var url = MongoUrl.Create(connectionString); _dbMigrations = new DatabaseMigrations(url); _locator = new MigrationLocator(migrationAssembly, _dbMigrations.GetDatabase(), new MigrationFactory()); _logger = logger; }
/// <summary> /// Creates a new instance of <seealso cref="MigrationRunner" /> /// </summary> /// <param name="url">A MongoDb connection string.</param> /// <param name="migrationAssembly">The target assembly containing migrations.</param> /// <param name="factory">The factory that's responsible for instantiating migrations.</param> public MigrationRunner(MongoUrl url, Assembly migrationAssembly, IMigrationFactory factory) { _dbMigrations = new DatabaseMigrations(url); _locator = new MigrationLocator(migrationAssembly, _dbMigrations.GetDatabase(), factory); }
/// <summary> /// Creates a new instance of MigrationRunner /// </summary> /// <param name="database">MongoDb IMongoDatabase instance</param> /// <param name="migrationAssembly">Assembly with migrations</param> /// <param name="factory">Factory responsible for instantiating migrations</param> public MigrationRunner(IMongoDatabase database, string migrationAssembly, IMigrationFactory factory = null) { _dbMigrations = new DatabaseMigrations(database); _locator = new MigrationLocator(migrationAssembly, database, factory ?? new MigrationFactory()); _migrationAssembly = migrationAssembly; }