Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upshot/Knockout Architectural Best Practices - What is the preferred provider to use in communicating between Upshot and .NET?

For a current project, I am trying to get a feel for how to effectively utilize Knockout 2.1.0, Upshot 1.0.0.2, ASP.NET MVC4, and Entity Framework 4.3. There are a lot of basic architectural questions which don't seem to have ready answers. I am enumerating several of my questions (in separate posts) in the hopes that someone can provide reasonable guidance for myself and others as we attempt to implement this combination in real-world applications.

In Steve Sanderson's awesome presentation on Knockout and Upshot.js at TechDays Netherlands in February, he mentioned Upshot can accommodate multiple methods of connecting to a server. (If you have not seen the presentation, it is well worth a watch. You can view it at http://channel9.msdn.com/Events/TechDays/Techdays-2012-the-Netherlands/2159.)

Unfortunately, he did not have time to detail what those communications mechanisms are or which was recommended and in what circumstances.

According to Denver Developer in his blog post titled “Digging into Upshot.js” (http://denverdeveloper.wordpress.com/2012/03/07/digging-into-upshot-js/), there are three data providers exposed by Upshot.js. These are:

• the default is DataProvider() and uses the /Submit method and the operation you provide it to get data using jQuery’s $.ajax method. (AG Note: I believe this generally connects with DbDataController objects exposed by WebAPI but am unsure of precisely what the limitations are.)

• the next is riaDataProvider() – similar to the first, but it uses the /json/SubmitChanges method and /json/{your opertion} to get data

• finally we also have odataDataProvider() – this one is quite different because it does not currently support updating data – it is read-only.

A number of closely related questions naturally present themselves regarding the selection of a provider for typical use.

  • Which data provider is better—the default data provider or the RIA data provider?
  • Which one is recommended for normal use and under what circumstances?
  • What are the performance implications of using the normal DataProvider vs the riaDataProvider?

On a related note, there appears to be very little documentation on upshot on the Internet. Other than drudging through the 4700+ lines of code in upshot.js, are there any other decent sources of documentation for this library?

The resources I have looked at so far include the following (plus a few more).

  • Source code from Steve Sanderson's SPA demo (available from http://blog.stevensanderson.com/2012/03/06/single-page-application-packages-and-samples/).

  • Source code from Bart Jolling's variations on Steve Sanderson's SPA demo application from his article on "Building Single Page Applications with ASP.NET MVC4" (parts 1-4). http://bartjolling.blogspot.com/2012/04/building-single-page-apps-with-aspnet.html

  • Big Shelf SPA demo code from ASP.NET site - http://www.asp.net/single-page-application/spa-samples/sample-bigshelf-application

  • Microsoft ASP.NET "A Tour through SPA" (basically focuses on upshot samples) http://www.asp.net/single-page-application/spa-samples.

like image 923
Anthony Gatlin Avatar asked May 23 '12 03:05

Anthony Gatlin


1 Answers

You should avoid using upshot and use http://www.breezejs.com/ instead

ASP.Net MVC Roadmap (note that upshot is not being developed further): http://aspnetwebstack.codeplex.com/wikipage?title=Roadmap

keep an eye on the road map plus john Papa's blog (http://www.johnpapa.net/building-single-page-apps-with-knockout-jquery-and-web-api-ndash-the-story-begins) - that should keep you on the right path

update : i just started playing around with hot towel - it roles Breeze, Durandal.js Knockout.js and Twitter Bootstrap (among others) into a very nice template ...its looking pretty cool so far

https://github.com/johnpapa/HotTowel

like image 151
Eamon Avatar answered Nov 16 '22 01:11

Eamon