Tip 49 – How to find your Data Service bug
I’ve been playing around with creating a custom Astoria Data Service Provider, aka DSP, for a while now.
So far I’d managed to get my metadata all setup, so browsing to $metadata works great. I’d got a few simple queries work.
Basically everything was going fine.
At least until I tried this URL:
I wasn’t sure what was going on exactly, and I couldn’t get any help from Fiddler, because it was having problems with the built-in VS web server.
And because my DSP was by design loosely typed, if I needed to spot the difference between this (bad):
And this (good):
Can you see the problem?
If you can good on ya, you’ve got sharper eyes than me…
Turns out that you don’t need sharp eyes, you just need to know about HandleException on DataService<> which you can override something like this:
Once I did this it was easy to spot that one of my dictionaries had an entry keyed on ID rather than Id.
After making the fix my query worked just great:
Knowing about HandleException is absolutely vital when developing an DSP, but it is more generally useful too, for things like auditing, error logging, you name it.
Oh and did you notice that my DSP exposes data from a list of dictionaries?
That is a story for another day ;)
Comments
- Anonymous
December 11, 2009
The comment has been removed - Anonymous
December 11, 2009
Thanks Craig - Anonymous
April 02, 2010
you have to do http://localhost.: to debug using fiddler.http://dotnetdevblog.blogspot.com/2008/12/fiddler-with-aspnet-development-server.htmltry reading this.-RN - Anonymous
April 03, 2010
Thanks RN!