Database Reference
In-Depth Information
Simple Demo App
For this first example, create a Windows Forms Application project. The name of the project and
language don't matter. When your project is created, follow these steps:
1.
Drop a list box and a button on the form.
2.
In Solution Explorer, right-click the References node, and select Add Service
Reference from the context menu.
3.
When the Add Service Reference dialog appears, you need the URI you copied
from Figure 7-6. Paste it into the Address field, and click the Go button. After
several seconds the available services and associated endpoints appear in the
Services section of the form, as shown in Figure 7-12.
Figure 7-12. Adding the OData service reference
4.
Leave the Namespace name as is, and click OK. A new Service Reference node
appears in Solution Explorer, which lists the service you just added.
In the code behind the form, add the following using statements:
using System.Data.Services;
using System.Data.Services.Client;
6.
5.
In the declaration section, add the following two lines of code. The first line
declares your context variable, which references the newly added service; the
second line defines the URI that accesses the OData service:
Search WWH ::




Custom Search