Sofia .NET User Group - Open Data Protocol (OData)

by Ventsy Popov
Recently I had a talk for the Sofia .NET User Group.  Actually it was my first speak for the user group and I was happy to see that after a couple of years of irregular gatherings, folks are still interested in these events. Nadya Atanasova who is lately the main engine for organizing us geeks, is doing a great job in promoting the meetings.

The topic of my speak was Open Data Protocol and WCF Data Services. With a few surprises - for example video recording with Microsoft Live Meeting (which I happened to have no experience with), we were able to start and cut to the chase :). First we travelled a bit in time, tracking the history of OData through Astoria and ADO.NET Data Services until it became a separate web protocol. After that we pulled some data out of Netflix (super exploited jQuery and OData example by the way :)):
       $(document).ready(function () {
            $.getJSON("http://live.visitmix.com/odata/Sessions?$filter=SessionID%20gt%20200&$format=json&$callback=?",
        function (data) {
            $.each(data.d.results, function (key, val) {
                
                var str = '<h3>' + val.Title  + '</h3>' + val.Abstract + '<br/>';

                $(str).appendTo('#images');
            });

        });
        });

And of course in honor of Microsoft, we played with a little C# code, implementing a simple WCF Data Services with exception handling:
    public static void InitializeService(DataServiceConfiguration config)
    {
        config.SetEntitySetAccessRule("*", EntitySetRights.All);
        // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
        config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    }

    protected override void HandleException(HandleExceptionArgs args)
    {
        args.Exception = new DataServiceException(
            args.ResponseStatusCode,
            args.Exception.InnerException.Message);

        base.HandleException(args);
    }
You can check out the slides and demos:

Presentations