6

我有一个类定义为:

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

根据我在这里找到的讨论:http ://groups.google.com/group/ravenb/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' to type 'System.Linq.Expressions.MemberExpression'。” 如图所示:

在此处输入图像描述 如何根据字典中的键进行查询?

4

1 回答 1

14

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

于 2011-04-29T05:16:11.513 回答