Example #1
0
        protected MongoDbWatcher(string name, MongoDbWatcherConfiguration configuration)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("Watcher name can not be empty.");

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration),
                    "MongoDB Watcher configuration has not been provided.");
            }

            Name = name;
            _configuration = configuration;
            _connection = configuration.ConnectionProvider(configuration.ConnectionString);
        }
Example #2
0
 /// <summary>
 /// Factory method for creating a new instance of MongoDbWatcher.
 /// </summary>
 /// <param name="name">Name of the MongoDbWatcher.</param>
 /// <param name="configuration">Configuration of MongoDbWatcher.</param>
 /// <returns>Instance of MongoDbWatcher.</returns>
 public static MongoDbWatcher Create(string name, MongoDbWatcherConfiguration configuration)
     => new MongoDbWatcher(name, configuration);
Example #3
0
 /// <summary>
 /// Factory method for creating a new instance of MongoDbWatcher with default name of MongoDB Watcher.
 /// </summary>
 /// <param name="configuration">Configuration of MongoDbWatcher.</param>
 /// <returns>Instance of MongoDbWatcher.</returns>
 public static MongoDbWatcher Create(MongoDbWatcherConfiguration configuration)
     => Create(DefaultName, configuration);