Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用客户端api解决ravendb中selectmany的问题_Ravendb - Fatal编程技术网

使用客户端api解决ravendb中selectmany的问题

使用客户端api解决ravendb中selectmany的问题,ravendb,Ravendb,我有一个像这样的ravendb课程: public class Student { public string Id { get; set; } public string TopLevelProperty { get; set; } public Dictionary<string, string> Attributes { get; set; } publ

我有一个像这样的ravendb课程:


        public class Student
        {
            public string Id { get; set; }
            public string TopLevelProperty { get; set; }
            public Dictionary<string, string> Attributes { get; set; }
            public Dictionary<string,List<Dictionary<string, string>>> CategoryAttributes { get; set; }
        }
和这样的文档:

由于selectmany,以下linq将不起作用:


                test = (from student in session.Query()
                        from eduhistory in student.CategoryAttributes["EducationHistory"]
                        where eduhistory["StartYear"] == "2009"
                              select student).ToList();
在StartYear==2009的情况下,我如何让所有学生参与

这样做:


test = session.Advanced.LuceneQuery()
            .Where("CategoryAttributes.EducationHistory,StartYear:2009")
            .ToList();
注意教育历史后的逗号而不是点。这表示我们正在查看列表,以在名为StartYear的其中一个项中查找属性。 如果我想要超过:


test = session.Advanced.LuceneQuery()
            .Where("CategoryAttributes.EducationHistory,StartYear:[2009 TO null]")
            .ToList();
等等。

这应该可以:

test = (from student in session.Query()
       where student.CategoryAttributes["EducationHistory"].Any(edu => edu["StartYear"]== "2009" )
       select student).ToList();

我遇到错误:无法将类型为“System.Linq.Expressions.TypedParameterExpression”的对象强制转换为类型为“System.Linq.Expressions.MemberExpression”。我正在使用一个已修复的构建:但是,我在这个查询中遇到了相同的错误。例如,我使用了where(“CategoryAttributes.EducationHistory,StartYear:*200*”)