示例#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));
 }
示例#3
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>
 /// <returns>Returns a MongoCollection from the specified type and url.</returns>
 public static IMongoCollection <T> GetCollectionFromUrl <T>(MongoUrl url)
     where T : IEntity <U>
 {
     return(MongoUtil <U> .GetCollectionFromUrl <T>(url, GetCollectionName <T>()));
 }
示例#4
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>
 /// <returns>Returns a MongoCollection from the specified type and connectionstring.</returns>
 public static IMongoCollection <T> GetCollectionFromConnectionString <T>(string connectionString)
     where T : IEntity <U>
 {
     return(MongoUtil <U> .GetCollectionFromConnectionString <T>(connectionString, GetCollectionName <T>()));
 }