예제 #1
0
 /// <summary>
 /// Creates and returns a MongoCollection from the specified type and url.
 /// </summary>
 /// <typeparam name="T">The type to get the collection of.</typeparam>
 /// <param name="url">The url to use to get the collection from.</param>
 /// <param name="collectionName">The name of the collection to use.</param>
 /// <returns>Returns a MongoCollection from the specified type and url.</returns>
 public static IMongoCollection <T> GetCollectionFromUrl <T>(MongoUrl url, string collectionName)
     where T : IEntity <U>
 {
     return(MongoUtil <U> .GetDatabaseFromUrl(url)
            .GetCollection <T>(collectionName));
 }
예제 #2
0
 /// <summary>
 /// Creates and returns a MongoCollection from the specified type and connectionstring.
 /// </summary>
 /// <typeparam name="T">The type to get the collection of.</typeparam>
 /// <param name="connectionString">The connectionstring to use to get the collection from.</param>
 /// <param name="collectionName">The name of the collection to use.</param>
 /// <returns>Returns a MongoCollection from the specified type and connectionstring.</returns>
 public static IMongoCollection <T> GetCollectionFromConnectionString <T>(string connectionString, string collectionName)
     where T : IEntity <U>
 {
     return(MongoUtil <U> .GetDatabaseFromUrl(new MongoUrl(connectionString))
            .GetCollection <T>(collectionName));
 }