Monday, January 28, 2013

OData And Entity Framework.

OData is probably one of the most powerful tools I've found.  It supports Interceptions, which means you can have authentication on any methods you need / want to lock down.

Most of Mobile development is making web service methods that allow you to Update / Create and Delete your Entities.  With OData.. most of that work can be quickly handled.

Frankly, getting it into use takes about 10 minutes, just to start working with it.  The needs of your project will determine how much additional work you need to do (Securing it, if it is a publicly exposed service, etc)  If you additionally install Entity Framework Power Tools, you get a whole lot of bang for your buck with an existing Database, with Code First.

I want to show you some urls, you can use, to see how powerful this tool is.

http://services.odata.org/website/odata.svc/ODataCustomers?$format=json
http://services.odata.org/OData/OData.svc/Products?$format=atom

Basically, on the fly, it will let me convert the Entity Objects, to Json format.. Atom, and XML (I believe these are the main formats that can be returned)

A great reference for using OData : http://www.odata.org/documentation/uri-conventions

If you go down this route, you might as well get a copy of LinqPad, it's a life saver.

LinqPad - The only way to fly with data and Linq.

Useful for getting the ODataService (Which allows $format=json in your OData Queries) if you are using an ASP.net Stack.

WCF Data Services ToolKit (Nuget)


A link for how to secure your OData Service with Custom Authentication.

Custom Authentication for OData.


LinqPad display of an OData Data Source.