QuickStart for building an Astoria data service

Here’s a quick start for checking out astoria. See my  blog post “what the heck is astoria” if necessary. 🙂

Requirements:
VS2008 Beta 2
Entity Framework Beta 2
Entity Framework Tools August CTP
Astoria CTP September refresh (which works with VS2008 Beta 2)

Note that I had to do this in XP. I’m having a wierd problem in Vista around the ASPNETCompatibilityEnabled setting in web.config. You can follow the discussion of that if you are interested in this forum thread. The thread is accidentally a combination of Kevin Hoffman’s issues with IIS and my issue with Cassini. They don’t seem to be related problems.

1. Start a new web application project (not website) in VS2008.

2. Add an ADO.NET Entity Data Model using the projects Add New Item dialog.
If you haven’t used the wizard before, you can see this blog post.
The basic steps are

  • Generate from Database
  • SElect a database (same as doing this for other data UIs in Visual Studio)
  • Just leave default names for things for this quickstart. (I pointed to Northwind in SQL Server and it defaulted at NorthwindModel and NorthwindEntities, etc)
  • Select all database objects (this is the default). This brings in tables, sprocs and views.
  • Then finish and you will see the EDMX file in the solution. You can double click on that to see the conceptual model (one of three parts of the model) in the designer. Note that this is just a simple way of getting a model from a database, the most basic type of conceptual model.

Add a Web Data Service.
Add New Item, choose Web Data Service. It’s in the main section (Visual Basic/ C#, not categorized into Data or Web templates) down on the bottom, alphabetical. 🙂

The services code view should open up. Note the TODO for the class. All you need to do is replace the stub [class name]

(VB)

(C#)

with the name of your entity wrapper class created in the model. THe model code gens a class file.
 

You can open up the model in teh designer and then see it’s Namespace and Entity Container Name in the properties.
 

That’s it! Now you can browse the web service directly (eg. right click on svc file in solution explorer and View in Browser) and start looking at how the data is exposed through the EDM.

My What the Heck is Astoria post walks through some quick query scenarios to give you an idea of what you can do.

This is just the tip of the iceberg of course. See the Astoria Team blog for more info.

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

4 thoughts on “QuickStart for building an Astoria data service

  1. Hi Julie I apologize for bugging you with rookie-type questions but I am not finding any information in the blogs. I installed OrcasBeta2, the Astoria Sept. release then the ADO EF and ADO EF tools.I create a project, then attempt to add an ADO.Net EDM but get the error dialog: "Object Reference not set to the instance of an object." Other items work correctly; WCF Services, etc.I am a Java-type trying to make the transition. If you have any ideas, I would greatly appreciate them.Maurice

  2. Hi Maurice. Happy to help! I don’t know if installing Astoria before EF would make a difference. When do you get the error? literally when you click ADO.NET Entity Data Model in the Add new Item dialog? Or somewhere else in the wizard?Another path to go down is this: did you have any wierd errors when installing the Entity Framework tools? Check out this blog post: http://blogs.msdn.com/adonet/archive/2007/09/04/entity-framework-tools-ctp-package-load-failure-workaround.aspxWhile, I’m happy to help, I want to make sure that you are aware of the Astoria forums because you’ll get access to people who are on the Astoria team as well as others (like myself) who have been exploring it. The url for that is [http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1430&SiteID=1]

Leave a Reply to Vish Cancel 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.