Search This Blog

What is ADO.NET Data Services?

ADO.NET Data Services exposes data, represented as Entity Data Model (EDM) objects, via web services accessed over HTTP. The data can be addressed using a REST-like URI. The Astoria service, when accessed via the HTTP GET method with such a URI, will return the data. The web service can be configured to return the data in either plain XML, JSON or RDF+XML. In the initial release, formats like RSS and ATOM are not supported, though they may be in the future. In addition, using other HTTP methods like PUT, POST or DELETE, the data can be updated as well. POST can be used to create new entities, PUT for updating an entity, and DELETE for deleting an entity.

The URIs representing the data will contain the physical location of the service, as well as the service name. In addition, it will also need to specify an EDM Entity-Set or a specific entity instance, as in respectively

http://dataserver/service.svc/MusicCollection

or

http://dataserver/service.svs/MusicCollection[SomeArtist]

The former will list all entities in the Collection set whereas the latter will list only for the entity which is indexed by SomeArtist.

In addition, the URIs can also specify a traversal of a relationship in the Entity Data Model. For example,

http://dataserver/service.svs/MusicCollection[SomeSong]/Genre

traverses the relationship Genre (in SQL parlance, joins with the Genre table) and retrieves all instances of Genre that are associated with the entity SomeSong. Simple predicates can also be specified in the URI, like

http://dataserver/service.svs/MusicCollection[SomeArtist]/ReleaseDate[Year eq 2006]

will fetch the items that are indexed by SomeArtist and had their release in 2006. Filtering and partition informationcan also be encoded in the URL as

http://dataserver/service.svs/MusicCollection?$orderby=ReleaseDate&$skip=100&$take=50