Linq to sql Linq到SQL错误

Linq to sql Linq到SQL错误,linq-to-sql,Linq To Sql,我收到此错误:无法将节点“列”格式化为SQL执行 当我尝试创建任何匿名类型时: select new { NounTypeName = nt.Name, Attributes = ( from a in nt.NounTypeAttributes group a by a.Attribute into g select new { NounTypeId = nt.NounTypeI

我收到此错误:
无法将节点“列”格式化为SQL执行

当我尝试创建任何匿名类型时:

 select new
 {
     NounTypeName = nt.Name,
     Attributes =
     (
         from a in nt.NounTypeAttributes
         group a by a.Attribute into g
         select new { 
             NounTypeId = nt.NounTypeId, 
             Key = g.Key + " (" + g.Count() + ")", 
             NounTypeAttributeId = 
                 (from i in g select i.NounTypeAttributeId)
                  .Take(1).SingleOrDefault(), Count = g.Count()
         }
     )
 });

当我在匿名类型中添加一个
NounTypeId
属性时,问题就出现了。

我是否可以建议将您的NounTypes和NounTypeAttributes加载到本地内存中,然后进行整形

CustomDataContext myDC = new CustomDataContext();
DataLoadOptions myOptions = new DataLoadOptions();
myOptions.LoadWith<NounType>(nt => nt.NounTypeAttributes);
myDC.LoadOptions = myOptions;

List<NounType> theNounTypes =
(
  from nt in myDC.NounTypes
  where //TODO filterExpression
  select nt
).ToList();

var queryResult = from nt in theNounTypes
  select new
...
CustomDataContext myDC=new CustomDataContext();
DataLoadOptions myOptions=newdataloadoptions();
myOptions.LoadWith(nt=>nt.NounTypeAttributes);
myDC.LoadOptions=myOptions;
列出所有类型=
(
从myDC中的nt开始
其中//TODO filterExpression
选择nt
).ToList();
var queryResult=来自countypes中的nt
选择新的
...