Search code examples
asp.net-mvc-4upshot

How to configure Upshot.js for an OData service?


In the Upshot.js library, that is part of the http://www.asp.net/single-page-application feature of ASP.NET MVC 4 Beta, how can it be configured to work with an OData service developed with WCF Data Services?

The source code contains a "upshot.ODataDataProvider"; how can it be used?


Solution

  • I have a sample project here that you can check out which has a working OData test: https://github.com/Marcus-L/Test-Upshot

    Here's a code snippet:

    upshot.dataSources = upshot.dataSources || {};
    upshot.dataSources.ParentThings = upshot.RemoteDataSource({
      provider: upshot.ODataDataProvider,
      providerParameters: { url: "/OData.svc", operationName: "ParentThings", operationParameters: { $expand: "Children"} },
      bufferChanges: true,
      dataContext: undefined,
      mapping: {}
    });
    upshot.dataSources.ParentThings.refresh();