質問

次のように定義されたクラスがあります。

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 '。 "示されているように:

enter image description here辞書のキーに基づいてクエリするにはどうすればよいですか?

役に立ちましたか?

解決

これはバグです、今は修正されています。約2時間で次のビルドで出ます

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top