我有一个像这样的 RavenDb 文档:
{
"ParentId": null,
"Order": 10,
"Url": "/sandbox",
"Rows":
[
{
"InstanceId": "2771a0d7-7f3f-4854-a3ba-27f25f88a45e",
"CSSClass": null,
"Columns":
[
{
"InstanceId": "b91495f5-b770-4da7-8073-ad3bd8221ca8",
"CSSClass": null,
"Span": 3,
"CMSModuleInstanceSettings":
[
{
"$type": "ModuleHTML.Models.ModuleHTMLInstanceSettings, ModuleHTML",
"IsActive": false,
"ShowAuthor": false,
"ShowDate": false,
"ShowCommentsCount": false,
"ShowLast2Comments": false,
"CMSModuleInstanceId": 417,
"ContainerClass": "default",
"ModuleType": "ModuleHTML",
"DisplayType": "Summary"
},
{
"$type": "ModuleHTML.Models.ModuleHTMLInstanceSettings, ModuleHTML",
"IsActive": false,
"ShowAuthor": false,
"ShowDate": false,
"ShowCommentsCount": false,
"ShowLast2Comments": false,
"CMSModuleInstanceId": 545,
"ContainerClass": "default",
"ModuleType": "ModuleHTML",
"DisplayType": "Summary"
}
],
"Id": 0,
"Name": null,
"CreatedOn": "0001-01-01T00:00:00.0000000",
"CreatedBy": 0,
"LastModifiedOn": "0001-01-01T00:00:00.0000000",
"LastModifiedBy": 0
},
...
],
...
},
...
],
...
}
我想检索页面文档并包含行、列,然后只包含活动的 CMSModuleInstanceSettings。
我努力了:
var page = documentSession.Query<CMSPage>()
.SingleOrDefault(p => p.Id == pageId)
.Rows
.Any(x => x.Columns
.Any(z => z.CMSModuleInstanceSettings
.Where(m => m.IsActive == true)));
但它返回:
Error 1 Cannot convert lambda expression to delegate type
'System.Func<CMS.Models.CMSColumn,bool>' because some of
the return types in the block are not implicitly convertible
to the delegate return type
我究竟做错了什么?