Presentation is loading. Please wait.

Presentation is loading. Please wait.

ASP.NET + jQuery + Odata = Goodness Stephen Walther Superexpert.com

Similar presentations


Presentation on theme: "ASP.NET + jQuery + Odata = Goodness Stephen Walther Superexpert.com"— Presentation transcript:

1 ASP.NET + jQuery + Odata = Goodness Stephen Walther Superexpert.com Stephen.Walther@Superexpert.com

2 Agenda Overview of OData/WCF Data Services Querying OData from jQuery Creating/Editing OData from jQuery Client/Server Validation Useful OData plugins

3 The Open Data Protocol (OData) Defined at Odata.org: ● Open Standard ● REST = Representational State Transfer ● Supports XML (Atom) and JSON ● XHR and JSONP

4 OData Data Sources Netflix NuGet Stack Overflow SQL Azure Azure Table Storage SharePoint 2010 Windows Live SQL Server Reporting Services eBay

5 WCF Data Services Exposes data using the OData protocol WCF Data Services February 2011 CTP2 ● Works with Entity Framework 4.1 (Code First)

6 WCF Data Services Exposes DBContext:

7 Querying OData OData URIs have three parts: ● Service Root ● Resource Path ● Query Options

8 Querying OData Query Options: ● $select ● $filter ● $top ● $skip ● $orderby ● $inlinecount ● $count $expand $format $links $metadata $value

9 Query OData (Operators)

10 Query OData (String Filters)

11 Query OData (Date Filters)

12 Query OData (Math Filters)

13 Query OData (Type Filters)

14 Query OData __metadata:

15 Query OData with jQuery

16 Create New Entities

17 Edit Existing Entities

18 Validation Client = Use jQuery Validate Use for immediate user feedback Server = Use Entity Framework Use for domain validation

19 Client Validation Use jQuery Validate to create client validation rules

20 Server Validation Use Data Annotation validators to validate properties:

21 Server Validation Use the IValidatableObject interface for more complex validation:

22 Server Validation Handle the Entity Framework DbEntityValidationException in your service class:

23 jQuery OData Plugin Created by Egil Hansen: ● https://github.com/egil/jquery.odata https://github.com/egil/jquery.odata Updated fork at: ● https://github.com/StephenWalther/jquery.odata https://github.com/StephenWalther/jquery.odata

24 DataJS Plugin Created by Microsoft: ● http://datajs.codeplex.com/ http://datajs.codeplex.com/ Supports reading and updating data Supports HTML5 DOM Storage

25 Resources ● WCF Data Services March 2011 CTP2 http://www.microsoft.com/downloads/en/details.aspx?FamilyID=60fb0117-8cea- 4359-b392-6b04cdc821behttp://www.microsoft.com/downloads/en/details.aspx?FamilyID=60fb0117-8cea- 4359-b392-6b04cdc821be ● Entity Framework 4.1 (Included with MVC3) http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2dc5ddac-5a96- 48b2-878d-b9f49d87569ahttp://www.microsoft.com/downloads/en/details.aspx?FamilyID=2dc5ddac-5a96- 48b2-878d-b9f49d87569a ● jQuery Templates Install-Package jQuery.Templates ● jQuery UI (Included with MVC3) Install-Package jQuery.UI ● jQuery Odata https://github.com/egil/jquery.odata/wiki https://github.com/StephenWalther/jquery.odata ● DataJS http://datajs.codeplex.com/

26 Download the Sample Code Visit Stephen Walther’s blog to download the sample code for this talk: ● http://StephenWalther.com http://StephenWalther.com

27 Website: http://Superexpert.comhttp://Superexpert.com Email: Stephen.Walther@superexpert.comStephen.Walther@superexpert.com Phone: 800 691 - 7140

28 Your Feedback is Important Please fill out a session evaluation form. Thank you!


Download ppt "ASP.NET + jQuery + Odata = Goodness Stephen Walther Superexpert.com"

Similar presentations


Ads by Google