Download presentation
Presentation is loading. Please wait.
Published byCuthbert Potter Modified over 9 years ago
1
MBL401.Net Compact Framework: Data Access Best Practices Paul Foster Mobile solutions architect
2
Agenda Overview Performance implications for design Solution architectures
3
Application style Native apps Local Store Native apps Cache & Proxy Web pages Big deviceBig bandwidth Store and forward Store and forward Data synchronisation Data synchronisation Network detection Network detection
4
Client Mobile Architectures Always-connected smart application Application calls data and services from main code Device must be online for app to function Data-caching smart application App calls data directly from source; saves data locally User defines when to use local versus Remote data Seamless online/offline application App always calls data from local cache/API (Mobility Data Layer) Local cache is self-synchronizing
5
Technology overview Client Base client SQL for CE Sync RDA Server MSMQ Exchange 2000 SQL 2000 PIM IIS XML Web Services MSMQ
6
Simple CRM demo demo demo
7
Application components Base Form Always Connected Seamless Online/offline Data Caching Desktop application XML Web service Contact Store.Net Compact Framework ASP.Net.Net Framework A single, common data access component across all platforms
8
Agenda Overview Performance implications for design Solution architectures
9
What Is Performance? Affected by two principles Absolute Performance of the system; the raw processing horsepower Apparent Performance of the application; affected by how the application is written Application performance is qualitatively measured by how responsive the application is to the end user
10
The Execution Engine A short review Compiled managed code is a binary in Microsoft Intermediate Language Code is just-in-time compiled to the native processor language on type-by-type, method-by- method basis Resulting native code is cached for later reuse Over the lifetime of the app, the up front cost of jitting is amortized, and becomes less and less significant
11
Code Pitching Occurs when large volumes of allocated memory cause memory pressure Runtime will discard or pitch code from the code cache Qualitative inspection will tell you when this occurs
12
Behavior Under Memory Pressure Memory utilization Performance
13
Performance data handling basics 1 Make asynchronous requests Defer data loading until it is required, discard when data no longer in use Minimize data in memory at any time
14
Performance data handling basics 2 Forward only reading is always faster than in memory representations XmlDocument versus XmlTextReader DataReader versus DataAdapter Use StringBuilder for complex string manipulations
15
Understand The APIs How abstract is the API? Example: XmlDocument versus XmlTextReader/Writer What work has to happen under the hood? Be aware of how events fire Don’t do a lot of work in a click event if a user will be tapping and dragging object
16
Alerts demo demo demo
17
Alerts Client Design strategies DataSet.ReadXML() 20 seconds total load time XMLTextReader – Forward Data Loading File Read Time 6 seconds (Total: 11 seconds) TreeView Load Time slow XMLTextReader + Delay TreeView Population File Read Time 2 seconds (Total: 3-4 seconds) TreeView Load Time faster SQL Server CE + Delay TreeView Population Query Time 3 seconds (Total: 3-4 seconds) TreeView Load Time faster (same as above)
18
Alerts Client Design strategies 1. DataSet.ReadXML() 20 seconds total load time 2. XMLTextReader – Forward Data Loading File Read Time 6 seconds (Total: 11 seconds) TreeView Load Time slow 3. XMLTextReader + Delay TreeView Population File Read Time 2 seconds (Total: 3-4 seconds) TreeView Load Time faster 4. SQL CE + Delay TreeView Population Query Time three seconds (Total: 3-4 seconds) TreeView Load Time faster (same as above)
19
On the wire optimizations Compression XmlElement and XmlAttribute
20
Agenda Overview Performance implications for design Solution architectures
21
DataSet limitations Datasets are convenient and fast to develop with but: Microsoft.Net only.Net Framework allows use of typed datasets.Net Compact Framework supports only un- typed datasets
22
Architecture for SOA Need three facades for three client styles Non-Microsoft.Net Framework.Net Compact Framework Can reuse logic for all three with final delivery onto the wire being unique.
23
Architecture for SOA example.Net Compact Fx.Net Framework Non-Microsoft WS Business logic Populates received DataSet Data source Parse to XML Create DS Create un-typed DS Create typed DS
24
Idempotent operations Ability to run an action many times with each outcome identical to the first. ATM machine example. Important to the mobile solution space because of the unreliable nature of wireless communications.
25
Idempotent solution Use of unique identifier to validate uniqueness of transaction. Business logic logs use of identifier and validates future transactions against this log. Enables determination of transaction state.
26
Idempotent solution Smart Client generates unique id Server Validates id ID unique Processes transaction ID previously used transaction rejected Web page has server generated id embedded within it Server Validates id ID previously used transaction rejected Id log ID unique Processes transaction Id log
27
Summary Understand connectivity characteristics of devices running apps Understand what is acceptable for data “freshness” Think asynchronously for best UI performance Design, test and iterate on your design considering multiple approaches Methodically analyze performance of your application Understand APIs Minimize data in memory
28
Ask The Experts Get Your Questions Answered Ask the Experts area Directly after this session and during lunch
29
Community Resources http://www.microsoft.com/communities/default.mspx Most Valuable Professional (MVP) http://www.mvp.support.microsoft.com/ Newsgroups Converse online with Microsoft Newsgroups, including Worldwide http://www.microsoft.com/communities/newsgroups/default.mspx User Groups Meet and learn with your peers http://www.microsoft.com/communities/usergroups/default.mspx
30
evaluations evaluations
31
© 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.
32
Demo Title Name Title Group demo demo
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.