Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction To .Net Compact Framework and SQL Server CE Development


Published on

Introduction to .NET Compact Framework and SQL Server CE database development.
With a focus on database techniques for occassionally connected scenarios.

Published in: Technology

Introduction To .Net Compact Framework and SQL Server CE Development

  1. 1. Introduction to .NET Compact Framework Development Mobile Data Synchronisation Techniques
  2. 2. Who Am I?
  3. 3. Microsoft Most Valuable Professional
  4. 4. Agenda <ul><li>Why? </li></ul><ul><li>Application Development </li></ul><ul><li>Mobile Data Storage </li></ul><ul><li>Data Synchronisation </li></ul><ul><li>Helpful Resources </li></ul>
  5. 5. The Device Landscape Windows Mobile, Pocket PC, SmartPhone, Windows CE Windows XP, Windows Vista, Windows XP Embedded Remote Controls , Wearable Devices, Auxiliary Displays Increasing functionality .NET Micro Framework .NET Compact Framework .NET Framework
  6. 6. .NET Compact Framework <ul><li>30% functionality in 10% space </li></ul><ul><li>X86, ARM, SH4, MIPS…. </li></ul><ul><li>Compatible Base Class Library </li></ul>Bring .NET to devices Performance and Tools Distributed and Data based apps
  7. 7. Windows Mobile History <ul><li>WinPad and Pulsar projects </li></ul><ul><li>Pegasus Group formed </li></ul><ul><li>H/PC reference design </li></ul><ul><li>Componentised Operating System </li></ul>
  8. 8. Typical Device Specifications Professional 200 – 700 Mhz 32 – 128 MB 128 MB Yes 240 x 320 Standard 100 – 300 Mhz 16 - 64 MB 64 MB No 176 x 220 Processor RAM ROM Touch Screen LCD Resolution
  9. 9. Development Constraints <ul><li>Minimal resources </li></ul><ul><li>Limited input </li></ul><ul><li>Touchscreen </li></ul><ul><li>No kitchen sink style apps </li></ul>
  10. 10. DEMO Smart Device Hello World Application Development
  11. 11. Why mobilise an application? <ul><li>Distributed work forces </li></ul><ul><li>Competitive advantage </li></ul><ul><li>Unlock potential of existing data </li></ul>
  12. 12. Rich vs Thin Clients <ul><li>Frequent round trips </li></ul><ul><li>Requires connectivity </li></ul><ul><li>Limited controls </li></ul><ul><li>Easy deployment </li></ul><ul><li>AJAX and Silverlight </li></ul>
  13. 13. Occasionally Connected <ul><li>Addressability and identity </li></ul><ul><ul><li>Dynamic IP addresses </li></ul></ul><ul><ul><li>Outbound only TCP and HTTP </li></ul></ul><ul><li>Quality of service </li></ul><ul><ul><li>Assume you are always offline </li></ul></ul><ul><ul><li>Need store-and-forward solution </li></ul></ul>
  14. 14. Network Aware <ul><li>A dynamic network environment </li></ul><ul><ul><li>Cost vs Priority decisions </li></ul></ul><ul><ul><li>Periodic background network checks </li></ul></ul><ul><ul><li>Notifications and connection status </li></ul></ul><ul><li>Adaptive application behavior </li></ul>
  15. 15. SQL Server Benefits Large data source Data is always fresh Rich query capability Limitations Constant connection Scalability (two tier) Query speed .NET Compact Framework ADO.NET Windows Forms SQL Server
  16. 16. SQL Server CE Benefits Local Cache Distribution Size Query Speed Limitations Simpler Data Types Stale Data Sync Complexity .NET Compact Framework ADO.NET Windows Forms SQL Server
  17. 17. SQL Server CE <ul><li>SQL Server Compact Edition 3.5 </li></ul><ul><ul><li>SQL Server CE </li></ul></ul><ul><ul><li>SQL Server Mobile </li></ul></ul><ul><ul><li>SQL Server Everywhere </li></ul></ul><ul><ul><li>SQL Server Anywhere </li></ul></ul>
  18. 18. Design Philosophy <ul><li>Supports desktop and mobile platforms </li></ul><ul><li>In-process database engine </li></ul><ul><li>Minimal duplication </li></ul><ul><li>Strong security </li></ul>
  19. 19. Compact vs Express
  20. 20. Deployment <ul><li>CAB for PDA </li></ul><ul><li>MSI for desktop </li></ul><ul><li>XCOPY style deployment for “non admin” installs… </li></ul>
  21. 21. Tool Support <ul><li>SQL Server 2005 Compact Edition </li></ul><ul><ul><li>Visual Studio 2005 </li></ul></ul><ul><ul><li>SSMS 2005 </li></ul></ul><ul><li>SQL Server Compact Edition 3.5 </li></ul><ul><ul><li>Visual Studio 2008 </li></ul></ul><ul><ul><li>SSMS 2008 </li></ul></ul>
  22. 22. Special Features <ul><li>SqlCEResultset </li></ul><ul><ul><li>Remember classic ADO? </li></ul></ul><ul><ul><li>Scrollable, Updateable, Sensitive cursor into server side resultset </li></ul></ul><ul><li>CommandType.TableDirect </li></ul><ul><ul><li>Bypass the query processor entirely </li></ul></ul>
  23. 23. Optimisation Techniques <ul><li>No connection pooling </li></ul><ul><li>Specify data types within parameterised queries </li></ul><ul><li>Query plan recompilation </li></ul><ul><li>Performance Monitoring </li></ul><ul><ul><li>XML Query Plan Generation </li></ul></ul><ul><ul><li>Index Stored Procedures!?! </li></ul></ul><ul><ul><ul><li>sp_show_statistics </li></ul></ul></ul>
  24. 24. DEMO SQL Server CE Optimisations
  25. 25. Data Syncronisation <ul><li>Technologies </li></ul><ul><ul><li>Merge Replication </li></ul></ul><ul><ul><li>Remote Data Access </li></ul></ul><ul><ul><li>Web Services </li></ul></ul><ul><ul><li>Email? </li></ul></ul><ul><li>Can be complimentary based upon requirements of individual data sets </li></ul>
  26. 26. Remote Data Access (RDA) <ul><li>Client (PDA) Initiated </li></ul><ul><li>Pulls one table at a time </li></ul><ul><li>Device-only change tracking (identity columns problematic) </li></ul><ul><li>Application submits SQL statement to SQL Server for execution </li></ul><ul><li>Minimal configuration </li></ul>
  27. 27. Merge Replication <ul><li>Publisher (Server) Initiated </li></ul><ul><li>Publications can filter data Horizontally and/or Vertically </li></ul><ul><li>Bi-directional change tracking </li></ul><ul><ul><li>Row or Column based </li></ul></ul><ul><li>Configurable conflict resolution </li></ul>
  28. 28. Web Services <ul><li>Abstract the database away from the messaging </li></ul><ul><li>Disconnected Service Agent </li></ul><ul><li>Windows Communication Foundation </li></ul><ul><ul><li>Store and Forward Messaging </li></ul></ul><ul><ul><li>Leverage ActiveSync AUTD feature and Exchange 2007 Web Services </li></ul></ul>
  29. 29. ADO.NET Sync Services <ul><li>Uses webservices to syncronise changes </li></ul><ul><li>Framework of “building blocks” </li></ul><ul><li>Not yet available for PDA use </li></ul>“ Developers can build sync ecosystems that integrate any application, any data from any store using any protocol over any network”
  30. 30. Hybrid Pattern Disconnected Service Agent Submit new and changed data to server via web service call 2 Mobile Data Gateway Merge/Replication Download reference, read-only data 1 Mobile Data Update Tables on Mobile SQL Server database updated 3
  31. 31. <ul><li>MCTS Exam 70-540 </li></ul><ul><li>Mobile LOB Accelerator </li></ul><ul><li>Microsoft Mobile Development Handbook </li></ul><ul><li>Windows Mobile Data Synchronization with SQL Server 2005 and SQL Server Compact 3.1 </li></ul>Finding out more
  32. 32. Contact Information Christopher Fairbairn ARANZ Medical Ltd Questions? Email: [email_address] Website: