gpt4 book ai didi

ravendb - 用RavenDb查询字典

转载 作者:行者123 更新时间:2023-12-04 13:29:09 24 4
gpt4 key购买 nike

我有一个类定义为:

public class Student
{
public string Id { get; set; }
public IDictionary<string, string> Attributes { get; set; }
}

基于我在这里找到的讨论: http://groups.google.com/group/ravendb/browse_thread/thread/88ea52620021ed6c?pli=1

我可以很容易地将实例存储为:
//creation
using (var session = store.OpenSession())
{
//now the student:
var student = new Student();
student.Attributes = new Dictionary<string, string>();

student.Attributes["NIC"] = "studentsNICnumberGoesHere";
session.Store(student);
session.SaveChanges();
}

但是,当我查询如下时:
//Testing query on attribute
using (var session = store.OpenSession())
{
var result = from student in session.Query<Student>()
where
student.Attributes["NIC"] == "studentsNICnumberGoesHere"
select student;

var test = result.ToList();
}

我收到错误消息“'System.Linq.Expressions.InstanceMethodCallExpressionN',键入'System.Linq.Expressions.MemberExpression'。”如图所示:

如何根据字典中的键进行查询?

最佳答案

这是一个错误,现已修复。
将在大约两个小时内发布到下一个版本中

关于ravendb - 用RavenDb查询字典,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5800685/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com