Mike Taulty's Blog
Bits and Bytes from Microsoft UK
ADO.NET Data Services - Tracing Messages from Client to Service

Blogs

Mike Taulty's Blog

Elsewhere

Archives

I (very foolishly) spent a few minutes today trying to figure out why applying WCF tracing configuration to a ADO.NET Data Services client (i.e. a proxy generated with webdatagen.exe) wasn't producing me any tracing results.

It didn't take too long to realise that the client proxy isn't actually a WCF proxy. It just uses HttpWebRequest directly.

If you want WCF tracing, put your configuration onto your service side code.

I didn't actually find WCF that useful in tracing messages here and so fell back to inserting a proxy and tracing at the HTTP level.

That didn't work perfectly for me either - I found most value by taking my Entity Framework class (i.e. the class that derives from ObjectContext) and then adding another class which derives from that, handling the SavingChanges event in the constructor and then sticking a breakpoint in my event handler server-side in order that I could have a look at the ObjectStateManager as calls come in from Data Services layer.

What I mean here is...

public class MyContext : demoEntities
{
  public MyContext()
  {
    this.SavingChanges += OnSavingChanges;
  }

  void OnSavingChanges(object sender, EventArgs e)
  {
    Debugger.Break();

    // Now we can use the debugger to look at the object
    // state manager.
    ObjectStateManager m = this.ObjectStateManager;
  }
}

where demoEntities is the ObjectContext-derived class that the EF tooling spits out for me from my database. That class is a partial class but the generation tool already throws out a default constructor so I thought it would be "better" to derive here.


Posted Wed, Jan 2 2008 10:57 AM by mtaulty
Filed under: ,

Comments

Christopher Steen wrote Link Listing - January 2, 2008
on Wed, Jan 2 2008 9:49 PM
ASP.NET  Weird DataGrid Paging Error with Last Page Selection [Via: Rick Strahl ] Sharepoint  Building...
tracing in ado net wrote tracing in ado net
on Sat, May 31 2008 12:34 PM