Pregunta

Tengo una clase definida como:

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

Basado en la discusión que encontré aquí: http://groups.google.com/group/ravendb/browse_thread/thread/88ea52620021ed6c?pli=1

Puedo almacenar una instancia con bastante facilidad como:

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

Sin embargo, cuando lo considero a continuación:

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

Recibo el error "'System.linq.expressions.instancemethodcallexpressionn' to type 'system.linq.expressions.memBerExpression'". como se muestra:

enter image description here¿Cómo puedo consultar en base a una clave en el diccionario?

¿Fue útil?

Solución

Este es un error, ahora se soluciona. Saldrá en la próxima construcción, en aproximadamente dos horas

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top