Every once in a while I’ll get inquires on a paper I wrote in 2004 about the ETW trace providers for ADO.NET (named “Tracing Data Access”). I got an inquiry today, and since I’d recently installed Visual Studio 2008 SP1 Beta, I thought I’d try it out on a LINQ to SQL program and an Entity Framework program.
If you haven’t read the paper, the original is still available on MSDN, but an embellished version (including SNAC tracing in addition to ADO.NET) was released in 2006. I’m also doing a talk at TechEd on “End-to-End tracing in ADO.NET and SQL Server 2008”. If you’re at all interested in client tracing or SQL Server 2008 Extended Events, it will be worth your while to attend.
Unless the LINQ to SQL program has its own ETW provider that I missed, I got no LINQ to SQL specific trace events. Since LINQ to SQL is a thin layer over System.Data.SqlClient, I do get the events for SqlClient however.
Entity Framework however, is another matter. I not only get EF-specific trace events, but there appears to be some new trace namespace abbreviations for EF as well. These are the ones I’ve seen while going through one trace of one simple EF program. I may have missed some.
dobj = System.Data.Objects
ec = System.Data.EntityClient
cqt = System.Data.Common.CommandTrees
pc = System.Data.Query.PlanCompiler
There’s quite a bit of trace information for some parts of EF, like the CommandTree portion. But after a whole half-hour and a few traces, it appears that not all items in EF are as thoroughly instrumented with trace events as, say, SqlClient. On the other hand, EF provider for SQL Server will show lots of SqlClient-specific and System.Data.Common events, as does LINQ to SQL.
2 thoughts on “Trace Events in ADO.NET Entity Framework”
I can assure you that the EF does not use DataSet under the covers at all. If there appears to be dataset activity, either there’s something else going on or there are some trace events being reused or something.
I would be interested to see the traces in question and investigate with you / my team.
Thanks,
Danny
Hi Danny,
After looking more into the trace, I still see a DataSet. It’s not being used by the internals of Entity Framework AT ALL(as you said), but it appears that it may be used in the process of dynamically registering the EntityClient data provider at run time. NOT for change tracking (or anything else in EF) as I’ve looked for references to "DataSet" in System.Data.Entity, System.Data.Entity.Design, and the "user program" that I traced with no hits. My misinterpretation.
I sent the information under separate cover.
Cheers,
Bob
Comments are closed.