net compact framework per ahlberg. agenda.net cf vs.net framework major areas base classes...

Post on 17-Jan-2016

227 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

.NET Compact Framework.NET Compact Framework

Per Ahlberg

AgendaAgenda

.NET CF vs .NET Framework

Major AreasBase Classes

Drawing/Forms

Data/XML

Web Services

Application DevelopmentEmulation and deployment

Communication and data

Security

AgendaAgenda

.NET CF vs .NET Framework

Major AreasBase Classes

Drawing/Forms

Data/XML

Web Services

Application DevelopmentEmulation and deployment

Communication and data

Security

The Mobile Device UniverseThe Mobile Device Universe

Infrastructure Servers, e.g. Network Operators

ToolsXML Web Services

Clients

Use

r Exp

erie

nce

s & S

olu

tion

sAuthentication SMS Voice CallsSubscriber DBMMS Data CallsPersonalization Billing etc…

A large number of devices…A large number of devices…

codeweb pages

Visual Studio.NET 2003Visual Studio.NET 2003

.NET Framework.NET Framework

Mobile Web Browser

Mobile Web Browser

.NET CompactFramework

.NET CompactFramework

client-sideapplications

webapplications

Application models for devicesApplication models for devices

Making Applications MobileMaking Applications Mobile

Mobility involves more than just being wireless

Truly mobile applications go anywhere

Data useful when offline

State of connectedness transparent to user and/or application

.NET CF design goals.NET CF design goals

CompatibilityStrict compatibility with .NET Framework

Subset functionality

Subsetting for devicesGive the developer a known target

Enable skills andcode transfer

Size/functionality

Provide critical mass needed for “real apps”

.NET Compact .NET Compact FrameworkFramework

.NET Framework.NET Framework

.NET Compact Framework.NET Compact Framework

Lightweight version of .NET Framework

Designed for resource-constrained devices

Compatible with VS.NET, C#, VB.NET

Runs applications securely on-deviceHigh performance JIT compiler

Guarantees robustness and security

Highly interactive, offline, and networked experiences

Makes it easy to consume web services

Tuned for size and performance

System

System.Data System.Xml

System.Web

Globalization

Text

Security

Collections

Resources

Reflection

Net

IO

Threading

Diagnostics

ServiceProcess

Configuration

Design

ADO.NET SqlClient

Xslt/XPath

XmlDocument

RuntimeInteropServices

Remoting

Serialization

Serialization

Configuration SessionState

Caching Security

ServicesDescription

Discovery

Protocols

UIHtmlControls

WebControls

System.Drawing

Imaging

Drawing2D

Text

Printing

System.WinForms

Design ComponentModel

Reader/Writers

.NET Framework.NET Framework

System

System.Data System.Xml

System.Web

Globalization

Text

Security

Collections

Resources

Reflection

Net

IO

Threading

Diagnostics

ServiceProcess

Configuration

Design

ADO.NET

SqlServerCe

SqlClient

Xslt/XPath

XmlDocument

RuntimeInteropServices

Remoting

Serialization

Serialization

Configuration SessionState

Caching Security

ServicesDescription

Discovery

Protocols

UIHtmlControls

WebControls

System.Drawing

Imaging

Drawing2D

Text

Printing

System.WinForms

Design ComponentModel

Reader/Writers

.NET Compact Framework.NET Compact Framework

.NET CLR Common Features.NET CLR Common Features

Verifiable type safe executionNo uninitialized variables, unsafe casts, bad array indexing, bad pointer math

Garbage CollectionNo ref-counting, no leaks

JIT compilation

Error handling with exceptions

Common type systemCall, inherit, and source-level debug across different languages

.NET CF CLR Differences.NET CF CLR Differences

COM InteropGood support for calling native DLLsSupport for calling a COM object through DLL wrappersNo support for writing a COM / ActiveX object in C# or Visual Basic

No install-time JIT (nGen)No remoting

Client web services is fully supported

No generic serializationDatasets can be serialized to XML

Subsets of other areas of functionality…

AgendaAgenda

.NET CF vs .NET Framework

Major AreasBase Classes

Drawing/Forms

Data/XML

Web Services

Application DevelopmentEmulation and deployment

Communication and data

Security

Base data types are the same as the desktop

Formatting

StringBuilder

Arrays

Value types (Int16, Int32, Int64, UInt16, etc…)

Floats and doubles

Collections Classes for storing sets of objects

Arraylists and Hashtables

Basic Data TypesBasic Data Types

NetworkingNetworking

Common Language Runtime

.NET Compact Framework

Web Services

HTTP Request/Response, Network Stream

Sockets

Applications

SocketsSynchronous and asynchronous

Multiple protocols

StreamsBuilt on top of sockets

Synchronous andasynchronous

HTTP request and response

Use stream model

ThreadingThreading

Applications start with an initial threadApplications can start new threadsUsing threads

Responsive UIProgram function segregation

Thread synchronization primitives

GlobalizationGlobalization

Culture-correct string comparison

Calendar math

DateTime and numeric formatting /parsing

External dataEncodings

.NET CF CLR is fully globalized

Windows Forms SupportWindows Forms Support

LayoutManual positioning

DrawingPolygons, lines, arcs, ellipses, rectangles

JPEG, BMP images

Text and imagesTrueType bitmap fonts

Most desktop controls

Designer support

Supported ControlsSupported Controls

Button

CheckBox

ComboBox

ContextMenu

DataGrid*

DomainUpDown

FileOpenDialog

Supported controls HScrollBar

ImageList

Label

ListBox

ListView

FileSaveDialog

MainMenu

NumericUpDown

Panel

PictureBox

ProgressBar

RadioButton

GroupBox RichTextBox NotificationBubble

Print Controls

StatusBar

TabControl

TextBox

Timer

ToolBar

TreeView

VScrollBar

Unsupported controls

Unsupported controls – not available in CECheckedListBo

x

ColorDialog

ErrorProvider

HelpProvider

LinkLabel

NotifyIcon

ToolTip

Splitter

FontDialog

DataData

ADO.NETDataSet

Databound controls

Managed providers

SQL Server for Windows CE

SQL Server (remote connection)

XMLXML

XmlTextReader and XmlTextWriter

Forward-only parsers of XML data

Better performance, no in-memory caching

Low memory requirements

XmlDocumentParse entire document

In memory traversal

Higher memory requirements; more functionality

Unsupported XML ClassesUnsupported XML Classes

XmlDataDocumentRelational and hierarchical views of XML

XPathQuery over unstructured XML data

XSLTTransform XML data to other forms

XML ValidationVerifies correctness of XML document

Web Services For DevicesWeb Services For Devices

Web ServicesSynchronous and asynchronous invocationHTTP/SOAPSupport calling into web services

Why?Rich local UIAggregate servicesCache data locally for offline use

Important considerationsBandwidth (How much? 802.11 or WWAN?)Use suitable subset of types

AgendaAgenda

.NET CF vs .NET Framework

Major AreasBase Classes

Drawing/Forms

Data/XML

Web Services

Application DevelopmentDeployment and emulation

Communication and data

Security

Application DeploymentApplication Deployment

Application install uses Windows CE installer technology

Visual Studio will auto-generate simple CAB files for device Installer

Include application and dependant references

Does not include the runtime or SQL-CE

Application Install will check for the runtime when installing

Temporary files are kept if user wants to customize the cab file contents

Framework SizeFramework Size

Framework size (RAM or ROM)~1.5 MB

Running RAM needs0.5 MB+ (depends on app)

Typical application sizes5 - 100 KB

Apps often smaller due to use of platform features in the framework

EmulationEmulation

Robust, accurate device emulation

Runs Windows® CE/PocketPC 2002 operating system on Windows XP

Emulates localized versions of the operating system

Can add images created in Platform Builder

Configurable in Device Settings in Tools Options

Configure RAM availability

Map PC hardware to the emulator

.NET Framework.NET Compact Framework

ActiveSync

File ReplicationDataSet XML

ADO.NET

WindowsForms

DataSet XML

ADO.NET

Service

ConsBound to single PC for data transfer

No synchronization model; works best with flood synchronizing

ProsGood for casually connected applications

Back end agnostic

Local caching for offline

Active Sync ReplicationActive Sync Replication

SQL Server

Windows Server

ADO.NET

Data Provider.NET Compact

Framework

ADO.NET

WindowsForms

ConsMust be constantly connected

Not scalable on server; classic “two tier” design

No synchronization model for typical dynamic data

ProsRich query into a large data source

Access to entire data source; device queries for and uses what’s relevant

Direct Database AccessDirect Database Access

Database

ADO.NET

ASP.NET

.NET Framework.NET Compact Framework

XML Web

Service

ConsComplex state and synchronization logic gets unwieldy

Carries bulk of XML data transfer

ProsWell deployed infrastructure (HTTP)

Information cached; Synchronization logicon server

Device communicates directly with source;no PC bridge

Local Data

WS Client

WindowsForms

Web Service ApplicationWeb Service Application

SQL CE

Replication (HTTP).NET Compact

Framework

SQL CE

ADO.NET

WindowsForms

SQL Server

Windows Server

ConsServer configuration required

Engine footprint on device

ProsVery robust local store

Complex SQL querying

Advanced/performant synchronization

Utilizes HTTP

SQL CE With ReplicationSQL CE With Replication

Database

ADO.NET

ASP.NET

.NET Framework.NET Compact Framework

XML Web

Service

SQL CE

WS Client

WindowsForms

Web Service with SQL CEWeb Service with SQL CE

ConsCarries bulk of XML data transfer

Mapping of XML to SQL CE

Footprint considerations

ProsWell deployed infrastructure (HTTP)

Information cached

Structured storage

Secure storage ofsensitive information

DataSets on DevicesDataSets on Devices

In-memory cache of a relational database

Aggregating multiple sources

Reading and writing XML

Remoted between tiers with XML Web Services

Foundation for consistent data model from server tiers, desktop applications and now devices

Data ProvidersData Providers

Providers included with .NET CFSystem.Data.SqlClient

System.Data.SqlServerCe

Custom Data ProvidersFollow interfaces to provide connection to custom data sources

Developer creates custom code translating remote structure to DataSet

SecuritySecurity

While transferring dataHTTP authentication

Secure sockets

No encryption for System.Data.SqlClient

While persisting dataSQL Server CE

Devices have the habit of disappearing; design for it

No caching of passwords

Encrypt sensitive data – SQL Server CE

When to choose?When to choose?

Windows CE .NETSupports the Win32 API

Will support .NET Compact Framework

Consider Win32 API when…Low-level driver code

Operating system extensions

Legacy code

Combination will serve you wellLeverage PInvoke

http://msdn.microsoft.com/library/en-us/dncenet/html/choose_api.asp

SummarySummary

Leverage your knowledge: Build device apps!

Desktop framework & tools

.NET languages (C#, VB .NET)

Choose the appropriate project template

Compile, debug, and deploy in Visual Studio .NET 2003Internet

http://msdn.microsoft.com/vstudio/device

http://gotdotnet.com/team/netcf/

msnews.microsoft.commicrosoft.public.dotnet.framework.compactframework

top related