Astoria: Data Services for the Web

Although my colleague Frank Fischer already mentioned it already on his Blog I think the technoloy is worth to mention it at least one more time. And it is worth because of the fact that the very early bits of a new technology from Microsoft are available for download. Astoria focuses on exposing data to web applications through an easy URI based access pattern combined with an entity data model approach which allows even stronger seperation of presentation from data. What's so cool about Astoria is the fact that as a web application developer you really don't have to care about connections to datastores, ADO.Net implementation details or SQL queries and all that because Astoria will automatically generate a Entity Data Model (EDM) including associations between certain entities from your database and expose the model as an Windows Communication Foundation based web service. The service itself is extended by Astoria such as you can access the data using regular URI syntax combined with a simple query syntax and it also allows bidirectional interaction using HTTP verbs such as GET and PUT. As this is a REST style interface it doesn't offer the richness of WS-* web services however since the purpose of Astoria is to create and offer pure data services which present their data as resources through the web REST is obviously the natural choice for such a technology.

Another really nice feature is that there are several options for the format of the payload data. You can choose from plain XML, JSON or a rudimentary RDF format which will evolve whith evolution of Astoria itself. That enables application developers to use the fromat that suits their application context best, e.g. an AJAX based web application will probably use JSON and WPF based smart client will probably use the plain XML.

There are also already some examples and tutorials ready to get a fast start on the technology so go and check them out. However be aware of a few gotchas which I found when walking through the tutorials:

  1. When you create an Astoria project make sure that you create a new project and not a new website as this will disable some of the item templates that you will need in order to create your Astoria data service

Create The Right Project

  1. If you use a SQL Server 2005 database you should set the "MultipleActiveResultSets" property of the connection to the value "True". If you do this within the advanced tab of the database connection wizard the property is not correctly added to the connection string which will be placed in the App.config file

Set PropertyCorrect Connection String

  1. If you create an AJAX web client based on the ASP.Net AJAX Extensions like outlined in the tutorial and you place the ScriptManager control on your page you will probably get a compile error as there is a reference to System.Web.Extensions missing

Add Reference

While you can read more details about the basics and the whys on the related documents in the resources section I compiled a screenshot walkthrough throug the tutorial's first part within this article.