我的课程定义为:

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'type'system.linq.expressions.memberexpression'。如图所示:

enter image description here如何根据字典中的键查询?

有帮助吗?

解决方案

这是一个错误,现在已修复。将在下一个构建中出现,大约两个小时

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top