Database Reference
In-Depth Information
private ServiceReference1.TechBio context;
private const string svcUri =
"https://OData.sqlazurelabs.com/OData.svc/v0.1/servername/TechBio";
7.
In the button's click event, add the following code:
context = new ServiceReference1.TechBio(new Uri(svcUri));
var userQuery = from u in context.Users
select u;
foreach (var u in userQuery)
{
listBox1.Items.Add(u.Name);
}
8.
Run the application. When the form displays, click the button. After a few
seconds, the list box populates with usernames, as shown in Figure 7-13.
Figure 7-13. Form displaying data via the OData service
Very simple, but a good foundation to build on. This example gives you an idea of how you can
consume on OData service via a .NET application. But you're probably tired of waiting, so let's move on
to the really cool example: the Windows Phone application.
Windows Mobile 7 Application
Let's build something cool (not that you haven't done that prior to this point). In this example, you
create a new application that consumes the same OData service that you consumed in the last example,
but this time you use a Windows Phone 7 application to consume the service.
Search WWH ::




Custom Search