【发布时间】:2009-04-15 20:00:51
【问题描述】:
我的扩展方法是:
public static IEnumerable<T> FilterCultureSubQuery<T>(this Table<T> t)
where T : class
{
return t;
}
我尝试在这个查询中使用它
var test = from p in t.Products
select new
{
Allo = p,
Allo2 = (from pl in t.ProductLocales.FilterCultureSubQuery()
select pl)
};
我的方法扩展的签名应该是什么?我总是收到这个错误:
方法 'System.Collections.Generic.IEnumerable`1[ProductLocale] FilterCultureSubQuery[ProductLocale](System.Data.Linq.Table`1[ProductLocale])' 不支持对 SQL 的转换。我也试过这个签名:
public static IQueryable<T> FilterCultureSubQuery<T>(this Table<T> t)
where T : class
{
return t;
}
我得到了这个错误:
方法 'System.Linq.IQueryable`1[ProductLocale] FilterCultureSubQuery[ProductLocale](System.Data.Linq.Table`1[ProductLocale])' 不支持 SQL 转换。谢谢
【问题讨论】:
标签: c# linq linq-to-sql extension-methods