Querying a dictionary using RavenDb

I have a class defined as:

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

based on the discussion I found here: http://groups.google.com/group/ravendb/browse_thread/thread/88ea52620021ed6c?pli=1

I can store the instance quite easily:

 //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(); } 

However, when I request it, as shown below:

 //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(); } 

I get the error "System.Linq.Expressions.InstanceMethodCallExpressionN" to print "System.Linq.Expressions.MemberExpression". "as shown below:

enter image description here How can I execute a query based on a key in a dictionary?

+6
source share
1 answer

This is a bug, now it is fixed. Will be in the next build in about two hours

+12
source

Source: https://habr.com/ru/post/886770/


All Articles