/// <summary> /// Initializes a new instance of the MongoRepository class. /// </summary> /// <param name="url">Url to use for connecting to MongoDB.</param> /// <param name="collectionName">The name of the collection to use.</param> public MongoRepository(MongoUrl url, string collectionName) { _collection = MongoService.GetCollectionFromUrl <T>(url, collectionName); }
/// <summary> /// Initializes a new instance of the MongoRepository class. /// </summary> /// <param name="connectionString">connection string to use for connecting to MongoDB.</param> /// <param name="collectionName">The name of the collection to use.</param> public MongoRepository(string connectionString, string collectionName) { _collection = MongoService.GetCollectionFromConnectionString <T>(connectionString, collectionName); }
/// <summary> /// Initializes a new instance of the MongoRepository class. /// </summary> /// <param name="url">Url to use for connecting to MongoDB.</param> public MongoRepository(MongoUrl url) { _collection = MongoService.GetCollectionFromUrl <T>(url); }
/// <summary> /// Initializes a new instance of the MongoRepository class. /// Uses the default connection string and Database name from the appsettings.json file. /// </summary> public MongoRepository(IOptions <MongoSettings> settings) : this(MongoService.GetConnectionString(settings)) { }