2011-04-27 85 views
6

我有一個類定義爲:查詢辭典RavenDb

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 如何根據字典中的鍵進行查詢?

+0

剛剛證實,它可以在不穩定的版本350中正常工作:http://builds.hibernatingrhinos.com/builds/ravendb-unstable – basarat 2011-04-30 21:46:34

回答

12

這是一個錯誤,現在已經修復。 將在下一個版本中,在大約兩個小時內

+3

永遠是一種榮幸,閱讀任何你寫 – basarat 2011-04-29 16:40:40