Getting started with Simple.Data OData provider

object edited this page Feb 11, 2013 · 13 revisions

The easiest way to start using Simple.Data OData provider is to install it’s Nuget package. In Visual Studio open Package Manager console and type the following:

Install-Package Simple.Data.OData

You will see output similar to this:

Attempting to resolve dependency 'Simple.Data.Core (≥ 0.18.1.0)'.
Successfully installed 'Simple.Data.OData 0.10.0'.
Successfully added 'Simple.Data.OData 0.10.0' to SimpleODataTest.

In the source file where you will be using OData provider import namespaces:

using Simple.Data;
using Simple.Data.OData;

Create an instance of dynamic database object that will be used to communication with OData feed:

dynamic db = Database.Opener.Open("http://packages.nuget.org/v1/FeedService.svc/");

Now you can start retrieving data from the OData server using Simple.Data syntax:

var package = db.Packages.FindByTitle("Simple.Data.OData");
Console.WriteLine(package.Title);

See also:
Retrieving data
Modifying data
Request authentication and interception