戻り値の型がTableである関数があります
このコードは機能しません。IEnumerable を Linq.Table ** として返したいだけです
public static System.Data.Linq.Table<Products> GetProducts()
{
MyContext mc = new MyContext();
Table<Products> ret = null;
// Or Table<Products> ret = mc.GetTable<Products>();
ret.AttachAll<Products>(mc.GetTable<Products>()
.OrderBy(p => p.ProductID).Take(1));
return ret;
}
ここで、IEnumerable クエリを System.Data.Linq.Table にキャストしたいと考えています。
(戻り値の型を変更できると言うかもしれませんが、問題はそれが可能かどうかです。GetTable() のような関数をオーバーライドできますか?)