我有一个像这样的 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; }
}
and a document like so:
由于 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();
请注意 EducationHistory 后面的逗号而不是点。这表明我们正在查看列表以查找名为 StartYear 的项目之一中的属性。
如果我想要大于:
test = session.Advanced.LuceneQuery()
.Where("CategoryAttributes.EducationHistory,StartYear:[2009 TO null]")
.ToList();
等等等等
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)