views:

561

answers:

5

Our team is evaluating using WCF Data Services (formerly ADO.NET Data Services), and have determined we'll have to create a Custom Data Service Provider. Where can we find a sample implementation of the two required interfaces: IDataServiceMetadataProvider and IDataServiceQueryProvider?

EDIT: Note that a "WCF Custom Data Service Provider" is not the same as an "ADO.NET Custom Data Provider."

EDIT: We have begun reverse-engineering using Reflector, but I would still appreciate it if somebody had a sample they would be willing to post!

A: 

I'm not aware of any open source / public implementations; your best bet may be to use .NET Reflector against an existing implementation.

RickNZ
...and the only existing implementation is the built-in Data Service Providers. That's what we've been doing so far, but it's slow going.
GuyBehindtheGuy
A: 

The code that you require to write will be dependent upon your data source.

You may be able to save development effort by using the standard ADO.Net Data Services, and extending them where necessary.

Take a look at this link on injecting custom code into ADO.Net Data Services: http://weblogs.asp.net/cibrax/archive/2009/06/08/injecting-custom-logic-in-ado-net-data-services.aspx

There is also a link from that page that shows some implementation details.

Shiraz Bhaiji
I'm aware it will be dependent on my data source. I'm just looking for a sample implementation to work from.Unfortunately, we need much more control over the data returned by the Data Service, including the use of Open Properties, so extending the existing Data Service Providers won't work for us. :-(
GuyBehindtheGuy
A: 

I assume MS used the WCF Data Service Custom Provider Interfaces when creating their SharePoint provider maybe we can find usage information by reflecting some SharePoint DLLs.

Peter Meinl
A: 

Finally! Alex James from Microsoft is blogging about this right now:

http://blogs.msdn.com/alexj/archive/2010/01/04/creating-a-data-service-provider-part-1-intro.aspx

GuyBehindtheGuy
A: 

I've just implemented my first DataService with custom provider two weeks ago, and was on the verge of giving up (even after reading AlexJ's blog post on custom providers.).

Then I found that the custom provider toolkit makes this task quite easy. Have a look at the solution and the way the demo web service therein is implemented. Then alter that demo project to fit your needs. It's much easier that coding all this from scratch, and the toolkit is built with reusability in mind anyway.

Adrian Grigore

related questions