It is easy to write queries and check the results in a browser. For example, to retrieve the first live presentation that includes "Blend" in its abstract, I just need to enter the following URL (see Figure 7):

Instead of entering OData queries in the browser, you can take advantage of the ODataService type provider to discover the data structure as you retrieve it. The following lines show the result of a quick FSI session that uses the ODataService type provider to connect to the INETA OData service and retrieves the first LivePresentation.

This way, I can check the properties provided by that LivePresentation instance. The following lines show another example of using the ODataService type provider to retrieve the first live presentation that includes "Blend" in its abstract.

This is straightforward code. InetaCatalog is the type abbreviation (or alias) for the ODataService type provider. The GetDataContext static method gets a simplified data context for the OData service. inetaDatabase is of type InetaCatalog.ServiceTypes.SimpleDataContextTypes.INETALivePublic. Because the type provider already established the connection and generated the necessary types, when you enter "inetaDatabase," IntelliSense displays the available methods, such as GetDataContext and the ServiceTypes with all the types required for the service as nested types.

You will notice how IntelliSense displays all the initial collections exposed by the OData service (see Figure 8):

LiveAuthors

LiveGroups

LivePresentations

LiveTags

LiveVideos

[Click image to view at full size]

Figure 8: IntelliSense displaying the Credentials and DataContext properties, and the collections that you can use as the source in a query expression.

In the previous example, the code uses LivePresentations as the data source for a query expression. Once you start writing the lines that define the query expression, the type inference mechanism knows that presentation is of type InetaCatalog.ServiceTypes.LivePresentation. Thus, after you write "presentation," IntelliSense displays the different fields available for the entity.

If you execute the code, you will see the title for an old presentation related to Blend on the console:

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!