我有一个像这样的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();
请注意 EducationHistory 后面的逗号而不是点。这表明我们正在查看列表以查找名为 StartYear 的项目之一中的属性。如果我想要大于:
test = session.Advanced.LuceneQuery()
.Where("CategoryAttributes.EducationHistory,StartYear:[2009 TO null]")
.ToList();
等等等等
| 归档时间: |
|
| 查看次数: |
924 次 |
| 最近记录: |