次の方法で共有


Improvement of the data binding experience with ADO.Net Data Services

In Visual Studio 2010 Beta1, the data binding experience with ADO.Net Data Services has been improved. In Visual Studio 2008 SP1, after adding an ADO.Net data service as web reference to a client project, it will not automatically show up in the data source window, you have to add an object data source to consume the ADO.Net data service. There is no more of this step in VS2010!

Let's take a look at the article of Walkthrough: Creating and Accessing an ADO.NET Data Service in Visual Studio (this is for VS2008 SP1). To create the client application consuming the ADO.Net data service, you have the following steps:

1) Create the client application

(Steps omit here)

 

2) Add a service reference

a) On the Project menu, click Add Service Reference.

 

b) In the Add Service Reference dialog box, click Discover.
The URL for the NorthwindCustomers service will appear in the Address field.

 

c) Click OK to add the service reference.

 

3) Enable data binding to the service

a) On the Data menu, click Show Data Sources.

 

b) In the Data Sources window, click Add New Data Source.

 

c) On the Choose a Data Source Type page of the Data Source Configuration Wizard, click Object, and then click Next.

 

d) On the Select the Object You Wish to Bind to page, expand the NorthwindClient node, and then expand the NorthwindClient.ServiceReference1 node.

 

e) Select Customers, and then click Finish.

 

4) Create the user interface

(Steps omit here)

 

In VS2010 beta1, you do not need to do step 3 anymore. ADO.Net data service is recognized automatically and happily shows up in the data source window. Alternatively, you can also add the ADO.net data service to your client project by the Data Source Configuration Wizard. Replace the step 2 above with the following:  

a. On the Data menu, click Show Data Sources.

b. In the Data Sources window, click Add New Data Source.

c. On the Choose a Data Source Type page of the Data Source Configuration Wizard, click Service, and then click Next. The next page will be the Add Service Reference dialog box. Now you just do the same thing just as adding the service reference through Add Service Reference project menu.

                       Blog1

At the end of Add service reference or the Data Source Configuration Wizard, you will see the following in the data source window (for the example in the walkthrough).

        blog2

Even more, if you update the ADO.Net data service, e.g. adding Orders to the EDM, and update the service reference, the data source window will update accordingly as the example shown bellow.

blog3

Cheers!

Comments