/// <summary>
 /// Initializes a new instance of the <see cref="MigrationRunner" /> class.
 /// </summary>
 /// <param name="migrationTarget">The migration target.</param>
 /// <param name="database">The database.</param>
 /// <param name="migrationLocator">The migration locator.</param>
 /// <param name="databaseStatus">The database status.</param>
 /// <param name="logger">The logger.</param>
 public MigrationRunner(IMigrationTarget migrationTarget, IMongoDatabase database, IMigrationLocator migrationLocator, IDatabaseMigrationStatus databaseStatus, ILogger <MigrationRunner> logger)
 {
     _migrationTarget = migrationTarget ?? throw new ArgumentNullException(nameof(migrationTarget));
     _database        = database ?? throw new ArgumentNullException(nameof(database));
     _databaseStatus  = databaseStatus ?? throw new ArgumentNullException(nameof(databaseStatus));
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     MigrationLocator = migrationLocator ?? throw new ArgumentNullException(nameof(migrationLocator));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MigrationRunner" /> class.
        /// </summary>
        /// <param name="database">The database.</param>
        public MigrationRunner(IMongoDatabase database)
        {
            IServiceCollection serviceCollection = new ServiceCollection()
                                                   .AddMongoMigrations()
                                                   .AddLogging(cfg =>
            {
                cfg.AddConsole();
            });

            serviceCollection.AddSingleton(database);

            var serviceProvider = serviceCollection.BuildServiceProvider();

            _database = database;

            _migrationTarget = serviceProvider.GetService <IMigrationTarget>();
            _databaseStatus  = _databaseStatus = serviceProvider.GetService <IDatabaseMigrationStatus>();
            _logger          = serviceProvider.GetService <ILogger <MigrationRunner> >();
            MigrationLocator = serviceProvider.GetService <IMigrationLocator>();
        }