Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/261.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
C# 根据LINQ将组拆分为实体-复合查询_C#_Linq_Entity Framework_Linq To Entities_Entity Framework 6 - Fatal编程技术网

C# 根据LINQ将组拆分为实体-复合查询

C# 根据LINQ将组拆分为实体-复合查询,c#,linq,entity-framework,linq-to-entities,entity-framework-6,C#,Linq,Entity Framework,Linq To Entities,Entity Framework 6,假设我有这样的东西: ... //Group By A into anotherGroupByRangeVariable ...//Group By B Operation = from item in anotherGroupByRangeVariable group featureTitleGroupItem by someKey into operationGroupin

假设我有这样的东西:

... //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
                        });
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 =  from item in anotherGroupByRangeVariable
                        group featureTitleGroupItem by
                        someKey into operationGrouping

                        select new Operation()
                        {
                            myProperty = operationGrouping.Key,
                            ...Other Attributes
                        });
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();
        }
当我尝试执行它时,我得到错误:

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实体中使用多个内部group by进行组合查询以使代码更具可读性的最佳方法是什么

是独立运行的第二个查询否,则将另一个GroupByRange变量作为参数传递给第二个查询。