Original URL: http://www.theregister.co.uk/2007/11/13/project_astoria/
There was a buzz last week at TechEd about Project Astoria (http://astoria.mslivelabs.com/Default.aspx). The reason is that it promises to simplify development of web applications that deal with data - which is most of them. Astoria is a REST API for ADO.NET, and hooks into the new Entity Framework object-relational mapping layer. Therefore, it solves two problems in one go.
Here's a quick look at how it works. Let's assume you have a database which stores some information you want to present in your web application. Step one is to use Visual Studio to generate an Entity Data Model from your database.
Next, you tweak the model so it looks as close as possible to the objects you are storing. The framework should deal with the complexities of mapping collections to linked tables and so on.
Now you create a new ADO.NET Data Service (sadly, this may well be the official name for Astoria), and point the service at your model. By default a new service does not expose any data, for security reasons, but by writing an InitializeService method you can configure which objects you want to publish.
Run the service, and the objects in your model are now URL-addressable. It's pretty flexible. For example:
[serviceurl]/Products : return all the products (yes, you can do paging).
[serviceurl]/Products[2]: return the product with an ID of 2.
[serviceurl]/Products[Color eq 'Blue']: return all the blue products.
[serviceurl]/Customers[2]/Orders/:return all the orders for the customer with an ID of 2.
The data comes back in either ATOM or JSON format. Naturally, each element in the returned data includes its URL. Let's say you have an AJAX application so you are calling this service from JavaScript. Iterating through the results and populating an HTML list or table is easy, especially as Astoria includes a client JavaScript library. There is also a client library for .NET applications. You can also add or update data with HTTP PUT, or remove it with DELETE.
You can extend your Astoria API by adding arbitrary methods that have the [WebGet] (or presumably [WebPut] or [WebDelete]) attribute. You can also add "interceptors" - code that gets called just before requests are executed, to enable validation or custom security.
Presuming it works as advertised, Astoria is a more natural and concise way to handle data than SOAP web services, and easier than devising your own techniques. It should work well with other technologies such as Adobe's Flex. It will play nicely with mash-ups, since many other services out there use ATOM or JSON. It is a natural fit with AJAX and will work well with Silverlight - see here (http://www.silverlightdata.com) (Silverlight 1.1 Alpha required) for an example.
Astoria will not be finished in time for the initial release of Visual Studio 2008, though reading between the lines it might be done in time for SQL Server 2008. It will work with any database server for which there is an Entity Framework provider. I was assured that creating such a provider is relatively easy, if you already have an ADO.NET 2.0 provider, so it is reasonable to expect wide support.
I think this will be popular.
This article originally appeared in ITWriting (http://www.itwriting.com/blog/?p=393).
Copyright (c) 2007, ITWriting (http://www.itwriting.com/).
A freelance journalist since 1992, Tim Anderson specialises in programming and internet development topics. He has columns in Personal Computer World and IT Week, and also contributes regularly to The Register. He writes from time to time for other periodicals including Developer Network Journal Online, and Hardcopy.
Microsoft teases mobile developers with 'big' Silverlight deals (17 April 2008)
http://www.theregister.co.uk/2008/04/17/silverlight_mobile/
Google warns third parties on GData mashups (18 March 2008)
http://www.theregister.co.uk/2008/03/18/google_gdata_third_party_warning/
Silverlight 2.0 data and web services explained (6 March 2008)
http://www.theregister.co.uk/2008/03/06/silverlight_two_data_services/
Build a Silverlight media player (9 January 2008)
http://www.theregister.co.uk/2008/01/09/silverlight_media_application_service/
Emacs diet for Visual Studio? (3 January 2008)
http://www.theregister.co.uk/2008/01/03/emacs_dot_net/
JBoss serves stuffed Eclipse IDE (11 December 2007)
http://www.theregister.co.uk/2007/12/11/jboss_developer_studio/
Google's next web toolkit thinks it's better than you (7 December 2007)
http://www.theregister.co.uk/2007/12/07/google_gwt_performance/
Microsoft wriggles on Volta concerns (7 December 2007)
http://www.theregister.co.uk/2007/12/07/volta_technology_preview/
The day Microsoft 'embraced and extended' Java (7 December 2007)
http://www.theregister.co.uk/2007/12/07/microsoft_java_sun_infamy/
Microsoft lets slip Visual Studio 2008 (19 November 2007)
http://www.theregister.co.uk/2007/11/19/visual_studio_2008_access/
Get started with Silverlight (5 November 2007)
http://www.theregister.co.uk/2007/11/05/get_started_with_silverlight/
Microsoft lifts Visual Studio usage restrictions (5 November 2007)
http://www.theregister.co.uk/2007/11/05/visual_studio_free_for_all/
Microsoft talks Sync and BI for SQL Server 2008 (5 November 2007)
http://www.theregister.co.uk/2007/11/05/sql_server_2008_sync_bi/
Visual Studio 2008 release by end November, Sync Framework announced (5 November 2007)
http://www.theregister.co.uk/2007/11/05/visual_studio_2008_november/
New tune for Microsoft software design? (22 October 2007)
http://www.theregister.co.uk/2007/10/22/bill_buxton_microsoft/
The Misfit Geek and AJAX acceptability (8 October 2007)
http://www.theregister.co.uk/2007/10/08/ajax_stagner_microsoft/
Adobe claims RIA completeness (1 October 2007)
http://www.theregister.co.uk/2007/10/01/adobe_air_ria_feature_complete/
MS shines Silverlight into thin AIR (and kicks 'beaten up' Google Gears) (17 September 2007)
http://www.theregister.co.uk/2007/09/17/microsoft_loves_silverlight_slams_adobe_air_google_gears/
© Copyright 2008