Brief Introduction
Microsoft’s ADO.NET team recently released a new project, as a Community Technology Preview (CTP), through Microsoft’s Live Labs. The project, codenamed “Astoria”, is a technology that allows developers to easily build and deploy data services (either on their own servers or to Microsoft’s hosted “Astoria Online Service”) that are accessible to applications through HTTP requests. This idea is not necessarily new – there are other ways to build a web services interface – but the ability to easily build a data service for SQL Server that is accessible through HTTP is definitely groundbreaking.
As the “Astoria” site preaches: this type of service is especially useful for AJAX-based applications that work hard on improving the user experience, through the use of Flash or Silverlight. Once an “Astoria” data service is published, you can query the underlying data structure by passing parameters in the URI. For example (and this is taken from the “Astoria” Overview document that is available on the Live Labs website):
To access all customers in a database:
http://myserver/data.svc/Customers
To access a customer whose key is “ALFKI”:
http://myserver/data.svc/Customers[ALFKI]
To find all orders that are associated with a customer whose key is “ALFKI”:
http://myserver/data.svc/Customers[ALFKI]/Orders
And so on, so forth. You can get much more focused than the above examples. You can drilldown into related data, filter out records, sort records, and even page records. You get the picture, right? It really is a powerful way to interact with a database.
How does “Astoria” make it so simple? Well, when you build an “Astoria” data service with Visual Studio (and, by the way, you need Visual Studio “Orcas”/2008 beta 1 to install the “Astoria” framework and build these types of data services) you build an Entity Data Model (EDM). “Astoria” then uses this model to wade through the underlying database and figure out how data are related. It can then use this simplified information to serve the data and make them accessible through the RESTful interface. “Astoria” can currently represent data in XML, JSON, and (as Pablo Castro, Microsoft’s ADO.NET technical lead, mentions in a really great presentation that he gave at MIX 2007) *very experimentally in RDF+XML. XML support is probably the most accepting, but JSON is, of course, perfect for use with AJAX applications.
Helpful/Interesting Resources
I find “Astoria”, and the underlying concept of taking complex data and making it broadly accessible intriguing. Again, I understand that this is not new territory. SOAP and other web services are a more powerful way of accessing data, but I see “Astoria”‘s restful interface meeting the needs of many. The ability to easily publish a database and make it accessible to the web is something that will allow many developers to build richer (and lighter-weight) web (and mapping!) applications.