Thursday, March 7, 2013

Profiling Database activity in Entity Framework

Profiling Database activity in Entity Framework

In Entity framework the LINQ to entities query can be traced by method, ToTraceString. For doing this first it needs to be converted in ObjectQuery.
var objQuery = from c in context.Customers where c.CustomerID == 3 select c;

var objectQuery=objQuery as System.Data.Objects.ObjectQuery;

Console.WriteLine(objectQuery.ToTraceString());

No comments:

Post a Comment