Notes from updating an Astoria project to the new SP1 Beta bits

The Astoria Team has provided a very impressive list of what’s changed and what’s new in the new bits for Astoria that were released with VS2008 SP1 today.

I was surprised to see they already have the Batching and Optimistic Concurrency stuff in there that they were only just recently considering.

Here are my own notes from trying to get an Astoria demo working before I had access to the nice list that is now available.

1) If you are using an Entity Framework EDM as your data source , there are some easy to fix (and easy to discover) breaking changes to the model.

See this post on my notes for updating an Entity Framework solution to SP1.

2) The service file is very different. You will be best to create it from scratch then move your logic into the new SVC file.

3) Namespaces and classes have changed.

  • Microsoft.Data.WebClient namespace becomes System.Data.Services
  • WebDataContext becomes DataServiceContext
  • WebDataQuery becomes DataServiceQuery

4) Methods for limiting access and the enums have changed

OLD config.SetResourceContainerAccessRule("*", ResourceContainerRights.AllRead);
NEW config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);

SetServiceOperationAccessRule stays the same

5) WebDataGen is now DataSvcUtil and can be found in C:\Windows\Microsoft.NET\Framework\v3.5\DataSvcUtil. The parameters for this were simplified, too.

I recommend using DataSvcUtil to recreate any classes you want to use in Astoria clients. I actually fixed one up manually before I found DataSvcUtil and it was a pain.

6) The Attribute used to identify the Key field (needed when the field names are not discoverable by Astoria) has changed.

It was <System.Web.DataWebKey()> and was used on the property.

Now it is System.Data.Services.Common.DataServiceKey(propertyname) and is used on the class. It can also take an array of strings if there are multiple keys.

7) The Silverlight and AJAX client libraries are not included with these bits but the AJAX one is  on CodePlex.

That’s two of my four demos from my Astoria talk. I’m currently trying to figure out how to retrofit the old ajax data services library into a new application.

There are probably lots more goodies in there, but these notes represent the pain I had to go through to get my Astoria demos that I’m doing this week at DevTeach working again.

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

One thought on “Notes from updating an Astoria project to the new SP1 Beta bits

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.