共用方式為


Astoria - Hello World Style Walkthrough

  1. Create a new project in Visual Studio "Orcas". Be careful not to create a new website.

    Choose the right project wizard

  2. Then choose Web --> ASP.NET Web Application as project type.

    Choose an ASP.NET web application

  3. Right-click on the application in solution explorer and choose Add --> New Item.

    Add new item to the project

  4. In the add new item wizard choose ADO.NET Entity Data Model

    Choose ADO.NET Entity Data Model

  5. In the ADO.NET Entity Data Model wizard select "Generate From Database" option.

    Select "Generate From Database"

  6. Select an existing or create a new database connection.

    Create new database connection

  7. If you choose to create a new connection then choose the database server and database in the connection wizard.

    Choose server and database

  8. Before committing the connection entries make sure to click on the advanced tab and change the "MultipleActiveResultSets" property to True. Although there is a bug in the wizard which causes the property not being picked up it is a good practice because you often forget to realize the advanced tab. Above that it is the natural way to set the properties and causes the least efforts in later versions when this bug is fixed.

    Set advanced properties

  9. Check the created connection string (the advanced property is missing as said before) and click "Next".

    Commit the connection dtails

  10. After you finish the connection wizard all artefacts of the entity data model are created and added to the project.

    EDM Artefacts

  11. Add a new item to the project which will be the actual service class. Choose Web Data Service from the template list.

    Add new item

  12. In the service class add the namespace of the entity data model artefacts using intellisense and insert the type of the Web Data Service generic class.

    Add namespace and generic type

  13. Finally add the "MultipleActiveResultSets" property set to "True" to the connection string in the App.config file.

    Complete the connection string manually

  14. Then build the project and start it. Then you can test your service using the root URI, any entity of the model or a query pattern and see the magic happen ;)

    Test your service

Comments

  • Anonymous
    May 10, 2007
    Although my colleague Frank Fischer already mentioned it already on his Blog I think the technoloy is
  • Anonymous
    September 17, 2007
    Astoria September 2007 CTP for Visual Studio 2008 Beta 2 is available After the release of Visual Studio
  • Anonymous
    September 29, 2007
    Astoria September 2007 CTP for Visual Studio 2008 Beta 2 is available After the release of Visual Studio