Today's entry is about a feature that allows ADO.NET Data Services to play very nicely with other software that runs on the Internet, like browsers or any program that can take URLs in fact.
Being REST-based, communication with an ADO.NET Data Service is made in terms of resources, like /Customers('ALFKI'), /Orders(123)/ShippingDate or /Regions?$top=10. We have different representations for these (ATOM, XML and JSON), which programs can interpret and process.
For certain resources, however, we can also provide a representation based on the "underlying value" rather than a more structured representation for it. Enter the $value suffix, which I've talked about in the past at http://blogs.msdn.com/marcelolr/archive/2008/01/21/service-operations-in-ado-net-data-services.aspx.
Let's say that customers have a "CompanyName" property. A URL such as service.svc/Customers('ALFKI')/CompanyName would refer to a resource that is an XML document with a single element called CompanyName, enclosing the value. The service will also accept service.svc/Customers('ALFKI')/CompanyName/$value, in which case the representation for the resource is just the value for the company name, with a MIME type of text/plain.
How do we pick the MIME type? By default, everything that is typically converted to text (most primitive values) are converted to text/plain. Values which are better suited to a binary representaiton (in particular, byte arrays), use application/octet-stream instead.
So if you have a property that is actually an image in your database, or perhaps an XML document, you can place the correct attribute on it and then direct a browser to it with an <img src=.... /> element, for example... The building blocks are open - I'm sure folks will come up with more interesting uses for this than I can think of right now!