Today I will lead you through the process of creating Astoria service. It is pretty easy as you’ll see. In my previous post I described the required packages to run Astoria.
There are mainly to stages:
Once you have them you can start Visual Studio 2008 Beta 2
Then select form the menu Project -> Add new Item… and select ADO.NET Entity Data Model
Then we follow the EF wizard to Generate Model from database
We select accordingly the connection to MS SQL Server which has AdventureWorks dabatase.
On next screen we select objects that will be added to EF Schema and click Finish button:
And we have the schema ready to use:
Now we are ready to setup Astoria Service:
Select form the menu Project -> Add new Item…
When we have class generated all we have to done is to set Context Object for EF Model. We enter AdventureWorksModel.AdventureWorksEntities and compile.
And this is all! We are ready to use it. It was pretty easy, wasn’t it?
Now let’s test it. All we have to do is loading AdventureWorks.svc from the browser:
On this screen we see all entities in the schema. We could navigate further with just changing URL:
You could play with some other Astoria specific queries like those (change your host:port to match yours):
There is one very good tool that you can use http://astoria.sandbox.live.com/tools/raw.htm . On order to use the page you must host it on same application as Astoria service otherwise browser single origin check will stop the requests. So Save the page and add it to your project