English 中文(简体)
Where can I find information on creating a WCF Data Services Custom Data Service Provider?
原标题:

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!

最佳回答

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

问题回答

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.

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

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.

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.

The best way to accomplish this is by using the WCF Data Services Toolkit.

The author/maintainer of this project also has a few blog posts on its usage. He doesn t detail how to use all its features - but does give you a great introduction and examples of how to use it.

It essentially lets you expose any object as an OData feed by implementing a Repository class. It handles all the reflection necessary to report back to the Data Services framework of what is the shape of your data.





相关问题
What is purpose of UpdateObject for Linq to REST?

When one is using ADO.NET Data Services and consuming it via the Linq to REST (formerly Project Astoria), it doesn t seem to be as intuitive as it could be. Namely, with normal Linq to SQL, the ...

ADO.NET DataServices with Prism

I ve start using prism with silverlight 3, but, we are trying to implement it to work with ADO.NET DataServices. The "DataServiceQuery" query type required to use with Silverlight, requires a ...

ADO.NET Data Services - Uploading files

I am trying to write REST web service through which our clients can upload a file on our file server. IS there an example or any useful links which I can refer for any guidance? I haven t seen many ...

热门标签