在 RavenDB 中查询嵌套列表时出现问题
我想在我正在做的项目中使用 RavenDB,但在此之前,我需要弄清楚如何查询嵌套对象......让我解释一下 我有一个这样的类:
public class Customer
{
public string Id { get; set; }
public string Name { get; set; }
public IList<Orders> { get; set; }
}
然后是 Order 类:
public class Order
{
public int OrderNumber { get; set; }
public decimal OrderAmount { get; set; }
public bool CustomerBilled { get; set; }
}
我创建了一堆假数据并将其添加到 Raven - 有些客户的订单仅将 CustomerBilled 设置为 true,有些将 CustomerBilled 设置为 false,还有一些混合了 true且 CustomerBilled 上为 false。
我需要帮助的是弄清楚如何提取 1 个或多个 CustomerBilled 设置为 false 的订单的客户列表。
我将如何创建一个查询来执行此操作?我似乎无法让一个人工作,而且我不知道如何做。
I want to use RavenDB for a project I am doing, but before I can, I need figure out how to query nested objects... Let me explain
I have a class like this:
public class Customer
{
public string Id { get; set; }
public string Name { get; set; }
public IList<Orders> { get; set; }
}
Then the Order class:
public class Order
{
public int OrderNumber { get; set; }
public decimal OrderAmount { get; set; }
public bool CustomerBilled { get; set; }
}
I create a bunch of fake data and add it to Raven -- some Customers have orders with only CustomerBilled set to true, some with CustomerBilled set to false, and some a mix of true and false on CustomerBilled.
What I need help with, is figuring out how to extract a list of Customers that 1 or more Orders with CustomerBilled set to false.
How would I create a query to do it? I can't seem to get one to work, and I have no idea how.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RavenDB 中的动态查询可以处理这个,我认为以下应该做你想要的(抱歉,我现在无法编译代码来验证)
编辑:在新链接上,向下滚动到“更多过滤选项”部分
The dynamic queries in RavenDB can handle this, I think the following should do what you want (sorry I can't compile the code right now to verify)
Edit: on the new link, scroll half way down to the section "more filtering options"