このコード行でエラーが発生していますSession.Linq<Employees>()
:
"非静的フィールド、メソッド、またはプロパティ'System.Web.UI.Page.Session.get'にはオブジェクト参照が必要です。
これは私のコードです:
public static object GetData(Dictionary<string, object> tableParams)
{
IQueryable<Employees> Employee = Session.Linq<Employees>();
if (tableParams.ContainsKey("sEcho"))
{
var parser = new DataTableParser<Employees>(tableParams, Employee);
return parser.Parse();
}
return Employee;
}
使用すると HttpContext.Current.Session.Linq<Employees>();
、次のようになります。
「System.Web.SessionState.HttpSessionState」には「Linq」の定義が含まれておらず、「System.Web.SessionState.HttpSessionState」タイプの最初の引数を受け入れる拡張メソッド「Linq」が見つかりませんでした。
これを機能させるには何をする必要がありますか?セッションに関してLinqの名前空間がありませんか?とを使用System.Linq
してSystem.Linq.Expression
います。