System.Data.Services


The documentation is online… isn’t this URI so very clean?


http://msdn.microsoft.com/en-us/library/system.data.services.aspx


Here’s the one-sentence-or-less explanation of what’s in this namespace, to give you a sense of what’s used where.


Setting Up Your Service
DataService<T> is the class that is typically subclassed, using the data source type as the ‘T’ type parameter, and brings everything together.


QueryInterceptorAttribute and ChangeInterceptorAttribute are used to plug into the read and write operations (UpdateOperations is used in the latter). You can also plug in by overriding the OnStartProcessingRequest method, which takes a ProcessRequestArgs argument.


IDataServiceConfiguration is used to set up configuration limits and uses EntitySetRights and ServiceOperationRights to figure out what operations are allowed where.


Data Support
ETagAttribute, IgnorePropertiesAttribute and MimeTypeAttribute are used to annotate models when you’re not using the ADO.NET Entity Framework.


SingleResultAttribute is used on service operations to indicate that they return a single item, and mostly affects how URLs over it are interpreted and composed.


IUpdatable is the interface to implement to support insert/update/delete operations when you’re not using the ADO.NET Entity Framework.


Expand Support
This will be very, very rarely used – you would only have to know about any of this if you wanted to use your own implementation of the $expand query option. IExpandProvider is the interface to implement, ExpandSegmentCollection and ExpandSegment are used to talk to it, and IExpandedResult is used to return wrapped results when expansion cannot occur in-line with the object model.


Hosting the Service
DataServiceHost, DataServiceHostFactory, and IRequestHandler are used to get the service working with Windows Communication Foundation (WCF), and usually there’s nothing to be done to get it up and running – the item template for an ADO.NET Data Service has the right directive to wire everything up. IDataServiceHost is the interface to implement if you want to host the data service without using WCF.


Error Handling
DataServiceException is an exception that knows about HTTP status codes and “safe for network” messages.


HandleExceptionArgs is used as an argument in the DataService<T> HandleException method, and allows you to tweak an exception that was caught for processing.


Well, that’s it for the namespace – as short an explanation I can give while still giving context as to the use for each type.


Enjoy!

Comments (2)

  1. It’s always been interesting to me to see how different people will approach learning a new API. Some

  2. I Love C# says:

    ADO.NET Data Services 5 Top Links 1. Using Microsoft ADO.NET Data Services 2. Data Services Create Data

Skip to main content