第一種方法
using (NORTHWNDModel.NORTHWNDEntities db = new NORTHWNDModel.NORTHWNDEntities())
第二種方法
{
var aaaa = db.Orders.Select(a => new { a.ShipName, a.ShipCity }).Take(10);
ObjectQuery oq = aaaa as ObjectQuery;
if (oq != null)
{
string SQLStr = oq.ToTraceString();
Response.Write(SQLStr);
}
}
using (NORTHWNDModel.NORTHWNDEntities db = new NORTHWNDModel.NORTHWNDEntities())
{
var aaaa = db.Orders.Select(a => new { a.ShipName, a.ShipCity }).Take(10);
MethodInfo mi = aaaa.GetType().GetMethod("ToTraceString");
if (mi != null)
Response.Write(mi.Invoke(aaaa, null).ToString());
}
第一種方法效率好很多..如果可以就用第一種方法ㄅ
轉http://bibby.be/search?updated-max=2009-05-19T22%3A30%3A00%2B08%3A00&max-results=7
沒有留言:
張貼留言