Question

J'ai une classe définie comme:

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

basé sur la discussion que je trouve ici: http: / /groups.google.com/group/ravendb/browse_thread/thread/88ea52620021ed6c?pli=1

Je peux stocker une instance assez facilement:

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

Cependant, quand je l'interroger comme ci-dessous:

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

Je reçois l'erreur « « System.Linq.Expressions.InstanceMethodCallExpressionN » taper « System.Linq.Expressions.MemberExpression ». » comme indiqué:

entrer dans la description d'image ici Comment puis-je requête basée sur une clé dans le dictionnaire?

Était-ce utile?

La solution

Ceci est un bug, il est maintenant fixé. Sera dans la version suivante, en deux heures

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top