Mobile Applications Startup - PowerPoint by oyj19812


Mobile Applications Startup document sample

More Info
									Mobile Applications with the
.NET Compact Framework

Twice IT Training
Alex Thissen
   Mobile applications
   Smart Device Extensions
   What’s new in
            Studio.NET 2003
      Visual
      Compact Framework

   Data options
   XML Web Services
   SQL Server CE 2.0
   .NET Development Platform for
   Devices overview
                                   Smart Device
                         Visual Studio .NET

                          .NET Framework

Server-side   ASP.NET Web Pages      Local Code     Client-side
Web Apps                                            Rich Apps

                Mobile Web           .NET Compact
                 Browser               Framework
Why SDE instead of MIT?
   MIT does not work offline
   Web pages do not have powerful UI
   SDE can use full power of processing
   Leverage SQL Server CE for data storage
SDE features of VS.NET 2003
   Essentially same experience as Desktop
   New project templates (Windows CE en
    Pocket PC) voor VB.NET en C#
       Introduces non-graphical application
   Only support for languages C# and VB.NET
   New Project properties and Device Options
   Emulators for any device image
       Pocket PC and Windows CE.NET 4.0 included
   Remote on-device debugging
   Samples and documentation
.NET Compact Framework
          System.Web                             System.WinForms
Services        UI                      Design         ComponentModel
 Description    HtmlControls
 Discovery      WebControls
 Protocols                                       System.Drawing
Caching         Security                Drawing2D         Printing
Configuration   SessionState            Imaging           Text

          System.Data                               System.Xml
ADO.NET         SqlClient               XmlDocument       Serialization
Design          SqlServerCe             Xslt/XPath        Reader/Writers

Collections      IO               Configuration         Runtime
Security         Net              ServiceProcess        InteropServices
Text             Reflection       Diagnostics           Remoting
Globalization    Resources        Threading             Serialization
Compact Framework architecture

                                             .NET Compact Framework CLR
 App Domain Host


                                  Platform Specific Class Libs

                   … Launch             Base Class Libs
                               Execution Engine (MSCOREE.DLL)

                                   Platform Adaptation Layer

                                     Host Operating System
What’s the same?
   Common Language Runtime
       Garbage Collection
       JIT compilation of MSIL
       Type safety
       Exception manager
       Common Type System (any language)
   Platform Invocation enables calls to CE
    Win32 Native API
   C# has 100% language compatibility
What’s different?
   COM Interopability not present
       No support for writing a COM object
       Write your own native wrapper classes and use
        P/Invoke to call wrapper
   Only 25% of class libraries present (less
    classes and overloaded methods)
   Only remoting option is client-side web
       No ASP.NET or .NET Remoting
   No generic serialization
What’s different? (continued)
   No reflection emit
   Cannot create native images (pre-JIT)
   No asynchronous delegates
   Can’t use or make ActiveX controls
Mobile applications
   This session has focus on working with data
       No attention to tools and utility apps
   Device must be mobile, not just wireless:
    take your data with you if necessary
   Connection state possibilities
       Permanent connection to network
       Occasional connection (docked or wireless)
   Switching from “connected” to
    “not connected” should be easy or
    transparent to user
Working with mobile data
   Accessing remote data
       Networking, ADO.NET Providers or XML Web
   Accessing local data
       ADO.NET DataSet or XML files
   Caching local data when offline
       SQL Server CE, ADO.NET persistence
   Synchronization of data when online
       ActiveSync, SQL Server CE Synchronization
 Data Access options

Windows                       Windows CE + SQL CE + .NET Compact Framework

 Server       Merge/      Fill(Query String) /         Select           Filter /
            Replication         Update              (Query String)       Sort
             or RDA
                     SQL-CE                 DataSet               DataView

Windows                                                         Data
          ActiveSync,             Read/Write
              Etc.                  XML
 XML                    XML                                        DataGrid
                                                   Web             Control
Using XML Web Services
   Web Service client fully supported on device
   Only Basic and Digest authentication
       Use Secure Sockets Layer (SSL) for secure
   All types of encoding
   Just add Web Reference in VS.NET 2003
       Generates regular SoapHttpClientProtocol
        wrapped proxy
       Instantiate proxy and call methods
ADO.NET Providers
   Two providers come with .NET CF
       SqlServerCE
       SqlClient (no Windows Integrated Security)
   Sql Server Client provider works just like for
    the desktop:
       Must have a “permanent” connection to
        backend server (not useful for offline support)
       Subset of classes are available
   Could write your own custom provider
SQL Server CE 2.0
   On device “mini” SQL Server
   Only one concurrent connection allowed
   One file databases (*.sdf files)
   Comes with a Query Analyzer
   Two main mechanisms to work with
    backend data:
       SQL CE Replication
       SQL CE Remote Data Access (RDA)
SQL Server CE 2.0 (continued)
   Install size approximately 800kB
   Supported platforms
       Windows CE 3.0+ (Pocket PC 2000/2002,
        Handheld PC 2000, Windows CE.NET 3.0/4.x)
       No longer support for Windows CE 2.x
        (PalmPC and HandheldPC 2.x)
   New from SQL CE 1.0:
       Parameter queries (only unnamed)
       Better exception support (SqlCeException)
       Configuration Wizard
SQL CE Storage Architecture
                      .NET CF / Managed Stack
                       VS.NET (VB.NET, C#)
 eVB                           ADO.NET               Ethernet

 3.0 eVC++            SQL Server      SQL Server       TDS
 ADO 3.0/4.0           CE Data        Client Data
  CE                   Provider        Provider        Well
 v3.1                         CLR / .NET CF          Connected
          OLEDB CE
                                                                          OLEDB /
                                                      802.11b,         Replication API
        SQL CE Edition v2.0          Data Provider     CDPD,
         OLEDB                                         CDMA,           Server
                                       Client        TDMA, etc.        Agent:
    QP/Cursor Engine/ES                Agent:                        Replication
                                     Replication             IIS        and
                                        and                           Remote
         OLEDB                                       HTTP
                                        RDA                             Data
      Storage Engine                                                  Access
    Replication Tracking                              Occasionally
SQL CE Replication
   Use SQL Server 2000 to create a publication of
    data for subscribers
       Conflict resolution
       Smart updates with delta changes in both directions
   Replicate data to device
   Subscriptions can be copied for easy deployment
    onto many devices
   Must use Merge replication
   SqlCeReplication managed class
       Add subscription of device to backend server
       Synchronize method brings downs entire database
        schema (indexes and relations) on first sync and
        changes on subsequent syncs
Remote Data Access
   Gives more direct access to backend server
   Server can be SQL Server 6.5 SP5 or higher
   Push and pull for every table
   Code your own relational integrity into
   SqlCeRemoteDataAccess managed object
       Three methods:
        Push, Pull and SubmitSql
RDA Pull
   Pull method gets a single table from
    backend SQL Server
   Must delete existing table before pull
       Use SqlCeCommand to access SQL Server CE
            WHERE TABLE_NAME=‘Orders’
           DROP TABLE Orders

   Must delete existing table before pull
   Specify whether to use batching or not
   No server configuration required
RDA Push
   Use Push to update backend server with
    data from SQL CE database
   Error table is used to store update errors
    during Push
       No concurrency conflict detection!
       Error table has a row for each error
       Examine errors from table and resolve conflicts
   Baching option
       On: all updates must succeed
       Off: row-level conflict detection
   Run SQL statements directly on database
   SQL statement cannot return rows
   All action occurs on backend server
       No local connection is needed
   Emulator is faster than device
   Device may have proprietary hardware
   Leave emulator open for faster startup
   Avoid Smart Minimize of PocketPC
       #if DEBUG
             this.MinimizeBox = false;
   Do not use Debug.Write for PocketPC
   Install loopback adapter for connectivity
   Easily deploy applications with CAB files
   Installs into Program Files directory
   Use .inf file to specify
       Directories, files, settings and configurations
       Can be found in obj folder of project
       Create customized versions under a different
        name and change BuildCab.bat
   Optional Setup.dll to further control setup
   Links:
       MSDN Library .NET Compact Framework
       MSDN Library Pocket PC and SmartPhone
   Books:
       Microsoft .NET Compact Framework (Core Reference)
       The Definitive Guide to the .NET Compact Framework
        Not yet released
   Compact Framework is subset of real .NET
   Smart Device Extensions make
    programming essentially same as desktop
   Inherent differences for mobile app as
    opposed to desktop apps
   Loads of data access options
Questions and Answers

To top