首页 文章

Linq错误“无法找到源类型的查询模式的实现'System.Linq.IQueryable'未找到加入”

提问于
浏览
2

What the hell does this mean? 忽略返回,获取,结果将被展平并卡在应用程序内存中(所以这将是一个集...可能)

"Could not find an implementation of the query pattern for source type 'System.Linq.IQueryable'. 'Join' not found. Consider explicitly specifying the type of the range variable 'a'."

private CommonDataResponse toCommonData
        {
            get
            {
                CommonDataResponse toCommonData = this.gatewayReference.GetCommonData();
                Array dCountries = toCommonData.PropertyCountries.ToArray(); //Webservice sends KeyValuePairOfString
                Array dRegions = toCommonData.Regions; //Webservice sends Array
                Array dAreas = toCommonData.Areas; //Webservice sends Array

                    var commonRAR = from a in dAreas
                        join r in dRegions
                         on a.RegionID equals r.Id
                        join c in dCountries
                         on r.CountryCode equals c.Key
                        select new {c.Value, r.Name, a.Name, a.Id };



                    return toCommonData;
            }
        }

dRegions / dAreas两个数组,dCountries是.toArray()

1 回答

  • 3

    Array 是一个非常松散的类型,并没有实现 IEnumerable<T> 等 . 您可以尝试将 Array 行切换为 var (让编译器选择类型) . 如果它仍然使用 Array ,则可能使用 .Cast<T>() 指定类型(或 Array.ConvertAll 等) .

    Array (没有更多信息),它知道的全部是 object .

    基本上, JoinIEnumerable<T>IQueryable<T> 上定义(作为扩展方法) - 而不是 IEnumerable (没有 <T> ) .

相关问题