/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="collectionName"></param> /// <param name="count"></param> /// <param name="query">条件查询。 调用示例:Query.Matches("Title", "感冒") 或者 Query.EQ("Title", "感冒") 或者Query.And(Query.Matches("Title", "感冒"),Query.EQ("Author", "yanc")) 等等</param> /// <param name="sortBy">排序用的。调用示例:SortBy.Descending("Title") 或者 SortBy.Descending("Title").Ascending("Author")等等</param> /// <param name="fields">只返回所需要的字段的数据。调用示例:"Title" 或者 new string[] { "Title", "Author" }等等</param> /// <returns></returns> public static List <T> GetAll <T>(string collectionName, int count, IMongoQuery query, IMongoSortBy sortBy, params string[] fields) { PagerInfo pagerInfo = new PagerInfo(); pagerInfo.Page = 1; pagerInfo.PageSize = count; return(MongoDBHelper.GetAll <T>(MongoDBHelper.connectionString_Default, MongoDBHelper.database_Default, collectionName, query, pagerInfo, sortBy, fields)); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="collectionName"></param> /// <param name="query">条件查询。 调用示例:Query.Matches("Title", "感冒") 或者 Query.EQ("Title", "感冒") 或者Query.And(Query.Matches("Title", "感冒"),Query.EQ("Author", "yanc")) 等等</param> /// <param name="pagerInfo"></param> /// <param name="sortBy">排序用的。调用示例:SortBy.Descending("Title") 或者 SortBy.Descending("Title").Ascending("Author")等等</param> /// <param name="fields">只返回所需要的字段的数据。调用示例:"Title" 或者 new string[] { "Title", "Author" }等等</param> /// <returns></returns> public static List <T> GetAll <T>(string collectionName, IMongoQuery query, PagerInfo pagerInfo, IMongoSortBy sortBy, params string[] fields) { return(MongoDBHelper.GetAll <T>(MongoDBHelper.connectionString_Default, MongoDBHelper.database_Default, collectionName, query, pagerInfo, sortBy, fields)); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="collectionName"></param> /// <param name="query">条件查询。 调用示例:Query.Matches("Title", "感冒") 或者 Query.EQ("Title", "感冒") 或者Query.And(Query.Matches("Title", "感冒"),Query.EQ("Author", "yanc")) 等等</param> /// <param name="pagerInfo"></param> /// <returns></returns> public static List <T> GetAll <T>(string collectionName, IMongoQuery query, PagerInfo pagerInfo) { return(MongoDBHelper.GetAll <T>(MongoDBHelper.connectionString_Default, MongoDBHelper.database_Default, collectionName, query, pagerInfo, null)); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="collectionName"></param> /// <param name="count"></param> /// <param name="sortBy">排序用的。调用示例:SortBy.Descending("Title") 或者 SortBy.Descending("Title").Ascending("Author")等等</param> /// <returns></returns> public static List <T> GetAll <T>(string collectionName, int count, IMongoSortBy sortBy) { return(MongoDBHelper.GetAll <T>(collectionName, count, null, sortBy)); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="collectionName"></param> /// <param name="count"></param> /// <param name="query">条件查询。 调用示例:Query.Matches("Title", "感冒") 或者 Query.EQ("Title", "感冒") 或者Query.And(Query.Matches("Title", "感冒"),Query.EQ("Author", "yanc")) 等等</param> /// <returns></returns> public static List <T> GetAll <T>(string collectionName, int count, IMongoQuery query) { return(MongoDBHelper.GetAll <T>(collectionName, count, query, null)); }
public static List <T> GetAll <T>(string collectionName) { return(MongoDBHelper.GetAll <T>(MongoDBHelper.connectionString_Default, MongoDBHelper.database_Default, collectionName)); }