Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP –...
-
Upload
brent-sydney-ross -
Category
Documents
-
view
216 -
download
0
Transcript of Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP –...
![Page 1: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/1.jpg)
Building Data Driven Applications Building Data Driven Applications Using WinRT and XAMLUsing WinRT and XAML
Sergey Barskiy, MagenicSergey Barskiy, MagenicMicrosoft MVP – Data Platform
Principal Consultant
Level: Intermediate
![Page 2: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/2.jpg)
OverviewOverview
• Dealing with Data in XAML Based Windows 8 Metro Style Applications
• WinRT – Windows Runtime
![Page 3: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/3.jpg)
Data Options in WinRTData Options in WinRT
• Persisting Data– Local
– Remote / Cloud
![Page 4: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/4.jpg)
Data BindingData Binding• INotifyPropertyChanged• INotifyCollectionChanged• Changed since preview
![Page 5: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/5.jpg)
Data Options In DetailData Options In Detail
• WCF Custom Services– SOAP
– REST
• Web Api– Part of MVC 4
• OData– WCF Data Services (coming soon..)
• Local– Windows.Storage
– SQLite (not yet)
![Page 6: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/6.jpg)
Setting up For WCF DevelopmentSetting up For WCF Development
• There is a setting in Project Properties to allow Loopback address or ..
• Find Your Application’s ID (HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Mappings
• Run CheckNetIsolation CheckNetIsolation LoopbackExempt -a -p=S-XXXXXX
• Update Manifest to enable Networking and Internet Client
![Page 7: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/7.jpg)
WCFWCF
• WCF Custom Services– Create new WCF Service / Add Reference
Data Contacts / Data Members / Operation Contracts– End point configuration
– Querying and updating data
– SOAP vs. REST
Soap is easier to use / proxy generation REST offers better performance and scalability
![Page 8: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/8.jpg)
WCF SOAP ServiceWCF SOAP Service
• Create new Service. Use Service Contract Operation Contract Data Member
– Define operations
– Build the service
– Add Service Reference to generate a proxy in Windows Metro Style project
– Handle data binding!
– Deploy the service
– Setup URL on proxy
![Page 9: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/9.jpg)
WCF REST ServiceWCF REST Service
• Create new Service. – Use new template to get a head start
– Define operations
WebGet, WebInvokeMessage Type XML vs. JSON
– Build the service
– Deploy the service
– Use HttpClient
– Use XML Serializer or JSON Serializer to convert data between service and client
– Use headers to set content type
![Page 10: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/10.jpg)
ASP.NET Web ApiASP.NET Web Api
• ApiController – Define actions
– Update route table if necessary / match Urls in client to actions
– Match actions to calls
– User serializers to convert the data
– Handle data binding
– Validation
![Page 11: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/11.jpg)
WCF Data ServicesWCF Data Services
• WCF Data Services– Subject to changes
There will be a client for WinRT Data Service Collection?
– Define a service
– Create proxy (http://odata.codeplex.com) DataSvcUtil.exe /uri:http://localhost/odataservice.svc/ /out:MyModel.cs /Version:2.0 /DataServiceCollection
– Configure end point
– CRUD operations
![Page 12: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/12.jpg)
Local StorageLocal Storage
• Using Isolated Storage– Using Serializers
– Helper class
![Page 13: Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.](https://reader035.fdocuments.us/reader035/viewer/2022062516/56649e245503460f94b125de/html5/thumbnails/13.jpg)
Data Options in WinRTData Options in WinRT
• Summary– Remote vs. local data
– Hosting remote data
Azure / Cloud Hosting providers
– Local Storage Options
FilesSQLite (coming later)
– Data binding / storage solutions