コード例 #1
0
 /// <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);
 }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
 /// <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))
 {
 }