Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 221
Fernando Correia Avatar asked Nov 14 '22 09:11

Fernando Correia


1 Answers

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();
like image 71
Marcus L Avatar answered Dec 15 '22 06:12

Marcus L