1 / 28

ASP.NET + jQuery + Odata = Goodness

ASP.NET + jQuery + Odata = Goodness. Stephen Walther Superexpert.com Stephen.Walther@Superexpert.com. Agenda. Overview of OData /WCF Data Services Querying OData from jQuery Creating/Editing OData from jQuery Client/Server Validation Useful OData plugins.

horace
Download Presentation

ASP.NET + jQuery + Odata = Goodness

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 • SQL Server Reporting Services • eBay • Netflix • NuGet • Stack Overflow • SQL Azure • Azure Table Storage • SharePoint 2010 • Windows Live

  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. jQueryOData Plugin • Created by Egil Hansen: • https://github.com/egil/jquery.odata • Updated fork at: • https://github.com/StephenWalther/jquery.odata

  24. DataJS Plugin • Created by Microsoft: • 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-6b04cdc821be • Entity Framework 4.1 (Included with MVC3) • http://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 • jQueryOdata • 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

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

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

More Related