我的擴展方法是:LINQ到SQL子查詢
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)
};
什麼應該是我的方法的簽名延期?我總是得到這個錯誤:
Method 'System.Collections.Generic.IEnumerable`1[ProductLocale] FilterCultureSubQuery[ProductLocale](System.Data.Linq.Table`1[ProductLocale])' has no supported translation to SQL.
我也試過這樣的簽名:
public static IQueryable<T> FilterCultureSubQuery<T>(this Table<T> t)
where T : class
{
return t;
}
而且我得到了這個錯誤:
Method 'System.Linq.IQueryable`1[ProductLocale] FilterCultureSubQuery[ProductLocale](System.Data.Linq.Table`1[ProductLocale])' has no supported translation to SQL.
感謝