Creating an OData Web Service with F#
Jomo Fisher—I’ve spent a little time looking at the OData Web Service Protocol. There is quite a lot to like about it. It is an open, REST-ful format for communicating with a web service as if it were a database. You can query an OData service with LINQ.
To help me learn about it I set out to write a simple OData web service. I expected to have to do quite a lot of work because OData is very rich and just parsing the urls, which can contain SQL-like queries, looked to be hard work.
It turned out, however, to be pretty straight-forward. You basically just need to implement IDataServiceQueryProvider and IDataServiceMetadataProvider. All the heavy-lifting in terms of parsing is done for you. You get a nice System.Linq Expression which is easy to deal with (mainly because my service uses LINQ to Objects under the covers).
If you’d like to take a look at the service I wrote, I published it on Visual Studio Gallery. You just need to go to File\New Project in Visual Studio 2010:
Please let me know what you think, and whether you have any issues or spot any bugs.
This posting is provided "AS IS" with no warranties, and confers no rights.