Some Astoria tips I learnt today

First of all let me start by saying that if you are doing Silverlight, you must learn Astoria, or as they call it nowadays, ADO.NET Data Services..

In a matter of minutes you can expose data from a database in a restful service that can be consumed by Silverlight 🙂

Now here are some things I learnt today…

The first tip is How can I have the Service on 1 server and the Silverlight app on another without having Cross Domain issues…

The answer to this is this url

Its important that you install the v1.5 CTP2 since by default this is not the version that comes with .NET 3.5 SP1 (Please note you also have to follow the rest of the steps… )

Another useful tip I learnt today is how to Expand a Property of a Property inside an entity (common when you have many to many relations). Example you have a Venue table that is linked to Sports with a table called VenueSportMapping. You can use XPath like syntax to load the property value.

   1: var query = from x in context.Venue.Expand("VenueSportMapping/Sport")

   2:                         select x;

Thats all I have for today… hope you find these 2 tips handy 🙂

happy coding 🙂