Creating Single Page Application, Web API, Upshot, An Exposed Service bring your data from Json Endpoints (maybe WEB API) … all of this is the new nueva moda.
This is nice till now. But the catastrophy started when you want to map your JSON with your EF Objects. Serializing stuff! Not Serializble! What the Hell! so change return type to ‘dynamic’ and bring ‘anonymous object’ … upshot is not documented!! And the Single Page Architecture Template (which is provided by Microsoft) .. Not mature enough! So simply they removed it from VS 12.
And Finally God guide me to JayData! Its amazing and phenomenal.
Imagine, Silverlight RIA can be used in Web. This “Framework” .. not just library
Solve this things in Previous Microsoft Single Page Architecture:
- Generating the whole EF Model + Metadata automatically using JaySvcUtil.exe (You can see this in video)
- Getting optimized Data (Just needed data):
In this image you can see how I’m getting the Whole users from the WCF Data Service.
map ==> Used to get a specific properties from the object (That’s will minimize the size of the requested data; which means some KBs instead getting the whooole object).
Also I’m using Knockout to bind UI Elements with self.users observable array
First Param is a predicate that brings a person by Id.
this.Id ==> Passed in Second param as you see.
And Third one; is the callbacks from the operation. Awesome!
showPerson binded with list of users using Knockout JS (2nd image shows how I binded Div Element with showPerson function).
What else, See this video