我们说我有这样的事情:
... //Group By A
into anotherGroupByRangeVariable
...//Group By B
Operation = from item in anotherGroupByRangeVariable
group featureTitleGroupItem by
someKey into operationGrouping
select new Operation()
{
myProperty = operationGrouping.Key,
...Other Attributes
});
为什么我无法提取第二个group by
并将其用于以下方法:
private static IQueryable<Operation> GroupByFeatureTitle(IGrouping<string, GroupByAItem> featureTitleGrouping)
{
return from item in anotherGroupByRangeVariable
group featureTitleGroupItem by
someKey into operationGrouping
select new Operation()
{
myProperty = operationGrouping.Key,
...Other Attributes
}).AsQueryable();
}
拨打电话:
... //Group By A
into anotherGroupByRangeVariable
...//Group By B
Operation = GroupByFeatureTitle(anotherGroupByRangeVariable)
当我尝试执行它时,我收到错误:
LINQ to Entities does not recognize the method 'System.Linq.IQueryable`1[Operation] GroupByFeatureTitle(System.Linq.IGrouping`2[NotificationChannelDao+ScopeChannelType])' method, and this method cannot be translated into a store expression.
在LINQ to Entities中使用多个内部组进行复合查询以使代码更具可读性的最佳方法是什么?