Exposing Data (not Database) with ADO.NET Data Services

Posted 3. travanj 2008 10:44 by dadamec

ADO.NET Data Services framework lets you publish data in a REST (Representational State Transfer) style. REST style in a short means: use standard protocol for conversation (today: HTTP - GET. POST, DELETE...) and queries (URIs) and drive data in standard format (today: XML, JSON).

The most tutorials and starter docs are showing publishing ADO.NET Data Service (it is really only special form of WCF service) over ADO.NET Entity Model and you could take "by default" that ADO.NET Data Services are for publishing Database data only. But it is not! I agree with Christian Weyer: Data != Database in ADO.NET Data Services. We could expose data from any source (other web service, hardcoded, any database etc.).

The only requirement for doing this is to use Microsoft.Data.Web namespace, [DataWebKey] for marking one of the class properties as key and use IQueryable interface with AsQueryable() method for making the DataContext for ADO.NET Data Service from our class.

In attached sample DataSvcClass.zip you could see that the class Event:

exposed over ADO.NET Data Service can be URI queryed over HTTP.


Download sample web site DataSvcClass.zip and try to send URI query to service for querying Event class.

Comments

# re: Exposing Data (not Database) with ADO.NET Data Services

7. travanj 2008 14:56 by anonymous

Christian Weyer just email me pointing that DataWebKey attribute is optional and that we can use "ID" property that is by default mapped as key for our class. I try it and it works.

Thanks Christian!

Leave a Comment

(required) 
(required) 
(optional)
(required)