Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
-
Upload
chris-woodruff -
Category
Technology
-
view
104 -
download
0
description
Transcript of Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
![Page 1: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/1.jpg)
Connecting to Data from Windows Phone 8
Chris WoodruffDirector, Perficient
Level: Intermediate to Advanced
![Page 2: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/2.jpg)
Who I am?
Chris Woodruff
MVP, Visual C#
Director at Perficient
Co-host of Deep Fried Bytes Podcast
@cwoodruff / [email protected] / Skype: cwoodruff
![Page 3: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/3.jpg)
You will learn:
• Understand the benefits of using REST web services for your mobile apps
• Have an understanding to develop solutions against OData that will give better experiences for your users
• How to shape your data queries to give the best performance for your mobile apps
• A glimpse into using Windows Azure Mobile Services to also get to your data in the cloud.
![Page 4: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/4.jpg)
LETS TAKE A REST
![Page 5: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/5.jpg)
• REST is an architectural style for distributed hypermedia systems
• REpresentational State Transfer• The term originated in 2000 by Roy Fielding for his
PhD thesis• REST states that the existing protocols and principles
of the web are enough to create robust Web Services – no SOAP is needed
What is REST?
![Page 6: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/6.jpg)
What does REST consist of?
REST is a very simple architecture:• Application state and functionality is divided into
resources.• Every resource is uniquely addressable using a universal
syntax for hypermedia links• All resources share a uniform interface for the transfer of
state between a client and a resource
![Page 7: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/7.jpg)
What does REST consist of?
Characteristics of REST• Client–server• Stateless• Cacheable• Uniform Interface• Named Resources• Interconnected Resource
Representations• Layered System
Operations of REST• GET• POST• PUT• DELETE
![Page 8: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/8.jpg)
Example of REST
Query a Resource
http://www.parts-depot.com/parts/getPart?id=00345
http://www.parts-depot.com/parts/00345
http://restbucks.com/PlaceOrder?coffee={type}&size={size}&milk={milk}&location={location}
![Page 9: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/9.jpg)
DIGGING INTO ODATA
![Page 10: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/10.jpg)
Open Data Protocol (OData)
• “RESTful” Web protocol• Designed to work with data across HTTP• Built on existing Web standards• Uses popular formats to return data payloads to
consumer• Uses self-describing metadata• Has multiple options to build implementation based on
standard protocol• Soon to be a full web standard
![Page 11: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/11.jpg)
The Basics
• Feeds, which are Collections of typed Entries• OData services can expose Service
Operations• OData services expose all these constructs via
URIs • OData service may also expose a Service
Metadata Document
![Page 12: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/12.jpg)
Full SQL like Query “Language”
HTTP Command (Verb)
SQL Command
GET SELECT
PUT UPDATE
POST INSERT
DELETE DELETE
![Page 13: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/13.jpg)
http://services.odata.org/OData/OData.svc\_______________________________________/ | service root URI
http://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$orderby=name\_______________________________________/ \__________________/ \_________________/ | | | service root URI resource path query options
What is an OData URI loo like?
![Page 14: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/14.jpg)
OData Best Practices (Producer)
• Always design your OData feed will server-side paging if your entity collections hold large amounts of data.
• Looks at server-side validation of queries and data updates based on the user credentials sent through HTTP
![Page 15: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/15.jpg)
Why are we excited!!
![Page 16: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/16.jpg)
ODATA AND HOW TO CONSUME IT IN WINDOWS PHONE
![Page 17: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/17.jpg)
DEMOWindows Phone and OData
![Page 18: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/18.jpg)
OData Best Practices (Consumer)
• Use Query Projection to only bring back the entity properties you or your app needs.
• Think about client-side paging even if their exists server-side paging.
• Design and implement a client-side data caching function in your app (unless sensitive data).
![Page 19: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/19.jpg)
AZURE MOBILE SERVICES AND HOW TO CONSUME IT IN WINDOWS PHONE
![Page 20: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/20.jpg)
DEMOWindows Phone and Azure Windows Services
![Page 21: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/21.jpg)
The demo projects can be found at:
github.com/cwoodruff/
![Page 22: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/22.jpg)
Resources
RESThttp://www.ics.uci.edu/~taylor/documents/2002-REST-TOIT.pdf
OData
http://odata.org
http://odataprimer.com
Azure Mobile Serviceshttp://www.windowsazure.com/en-us/develop/mobile/
![Page 23: Connecting to Data from Windows Phone 8 VSLive! Redmond 2013](https://reader034.fdocuments.us/reader034/viewer/2022051613/54c6f4254a7959e5658b45a1/html5/thumbnails/23.jpg)
Contact Me
Chris “Woody” [email protected]
Twitter @cwoodruff
Skype cwoodruff
http://chriswoodruff.com
http://deepfriedbytes.com