Пример #1
0
 /// <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>
 /// <returns>数据对象集合</returns>
 public static List <T> GetManyByCondition <T>(string collectionName, IMongoQuery query) where T : IEntity <string>
 {
     return(MongoDbHepler.GetManyByCondition <T>(nosqlConnectionString, nosqlDbName, collectionName, query).ToList());
 }
Пример #2
0
 /// <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>
 /// <returns>数据对象集合</returns>
 public static List <T> GetManyByCondition <T>(string collectionName, IMongoQuery query)
 {
     return(MongoDbHepler.GetManyByCondition <MongoModel <T> >(nosqlConnectionString, nosqlDbName, collectionName, query).Select(u => u.Data).ToList());
 }