- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在使用 mongoDB C# 驱动程序 2.4.0,当我尝试使用 LINQ 时出现错误:
Method not found: 'MongoDB.Driver.Linq.IMongoQueryable`1<!!0> MongoDB.Driver.IMongoCollectionExtensions.AsQueryable(MongoDB.Driver.IMongoCollection`1<!!0>, MongoDB.Driver.AggregateOptions)'.
我要获取集合的上下文类片段是:
public IMongoCollection<SGProduct> Products
{
get
{
return Database.GetCollection<SGProduct>("SGProductRepository");
}
}
我用来从mongo中提取数据的方法是:
public void GeHouseDetailByProduct(string catID)
{
var query = (from p in MongoContext.Products.AsQueryable()
join h in MongoContext.House.AsQueryable() on
p.HouseID equals h._id
where p.ProductCategoryID == catID
select h);
}
知道我在这里做错了什么。谢谢
最佳答案
我通过将驱动程序从 2.4 降级到 2.2 解决了这个问题。仍然不确定为什么 c# 驱动程序 2.4 不支持这个。
谢谢
关于c# - MongoDB AsQueryable(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42952620/
我在使用 AsQueryable 时遇到问题,我发现了一些示例,其中此扩展需要强制转换,即 AsQueryable,在某些示例中,直接转换为 AsQueryable()。我用 Stopwatch 检查
也许这是个简单的问题,但是AsQueryable()有一些性能损失? 一般来说,我们正在使用 RavenDB,并且我们有这样的现有代码 protected override IQueryable Qu
我正在使用 mongoDB C# 驱动程序 2.4.0,当我尝试使用 LINQ 时出现错误: Method not found: 'MongoDB.Driver.Linq.IMongoQueryabl
AsQueryable() 的目的是为了让您可以将 IEnumerable 传递给可能需要 IQueryable 的方法,还是有一个将 IEnumerable 表示为 IQueryable 的有用理由
我是 mongodb 的新手,正在尝试在我的应用程序中使用 mongodb 实现存储库模式。所以我的问题是当我使用以下查询查询数据库时: _mongodb.GetCollection(typeof(T
示例代码: List Students = new List() { new Student(101, "Hugo", "Garcia", new List() { 91, 88, 7
我遇到了以 (...).ToList().AsQueryable() 结尾的 linq 查询。我知道分别使用 .ToList() 和 .AsQueryable() 。但是,如果两者结合,结果会怎样呢?
如果给定任何参数“名称”和“价格”或仅提供名称,我正在尝试让我的查询输出所有数据。我尝试使用 'Any' 参数,但它给了我 -- Cannot implicitly convert type 'boo
因此 IQueryable 允许您的查询在数据库级别执行,而不是像 IEnumerable 那样在内存中的对象集合上执行。如果我有一个 IEnumerable 并在其上调用 AsQueryable()
我在 C# 中使用最新的 ServiceStack OrmLite(当前为 v4.5.6) 我需要从一个方法返回 asQueryable,例如; using (IDbConnection da
我有一个通用字典,它传递给一个只接受 IQueryable 作为参数的方法 是否可以将可查询对象转换回原始字典?我并不是说用 .ToDictionary(...) 创建一个新字典 private st
我正在使用 Entity Framework CodeFirst,其中我使用 ICollection 作为 Parent Child 关系 public class Person { publi
我有两个模型,一个用户和一个团队,如下所示: [BsonRepresentation(BsonType.ObjectId)] public ObjectId _id { get; se
我开始使用存储库模式通过 Entity Framework 进行数据访问和 LINQ作为非测试存储库实现的基础。当调用返回 N 条记录而不是 List 时,我看到的大多数示例都会返回 AsQuerya
我知道第一个实现的 LINQ to Entities 和 LINQ to Objects 的一些区别 IQueryable和第二个工具 IEnumerable我的问题范围在 EF 5 之内。 我的问题
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
我有一个扩展方法可以对 IEnumerable 和 IQueryable 进行操作。该方法解析输入并在最后调用 Skip().Take()。 public static IEnumerable Sel
我正在尝试向 MongoDB 编写 LINQ 查询: using MongoDB.Driver; using MongoDB.Driver.Linq; namespace ConsoleApplica
案例 1:我在两个上下文中通过 ToList() 方法加入了两个不同的数据库上下文。 案例 2:并且还尝试使用 ToList() 加入第一个 Db 上下文,然后使用 AsQueryable() 加入第
我有这个 if 语句,它将结果作为 AsQueryable 返回到匿名类型: If (signature = "") Then testResults = (From
我是一名优秀的程序员,十分优秀!