Title: 'NET Compact Framework
1.NET Compact Framework
2Agenda
- .NET CF vs .NET Framework
- Major Areas
- Base Classes
- Drawing/Forms
- Data/XML
- Web Services
- Application Development
- Emulation and deployment
- Communication and data
- Security
3Agenda
- .NET CF vs .NET Framework
- Major Areas
- Base Classes
- Drawing/Forms
- Data/XML
- Web Services
- Application Development
- Emulation and deployment
- Communication and data
- Security
4The Mobile Device Universe
Clients
User Experiences Solutions
Tools
XML Web Services
Authentication SMS Voice CallsSubscriber
DB MMS Data CallsPersonalization Billing etc
Infrastructure Servers, e.g. Network Operators
5A large number of devices
6Application models for devices
Visual Studio.NET 2003
.NET Framework
code
web pages
webapplications
client-sideapplications
Mobile Web Browser
.NET CompactFramework
7Making 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
8.NET CF design goals
- Compatibility
- Strict compatibility with .NET Framework
- Subset functionality
- Subsetting for devices
- Give the developer a known target
- Enable skills andcode transfer
- Size/functionality
- Provide critical mass needed for real apps
.NET Framework
.NET Compact Framework
9.NET Compact Framework
- Lightweight version of .NET Framework
- Designed for resource-constrained devices
- Compatible with VS.NET, C, VB.NET
- Runs applications securely on-device
- High 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
10.NET Framework
11.NET Compact Framework
System.Web
System.WinForms
Services
UI
Design
ComponentModel
Description
HtmlControls
Discovery
WebControls
System.Drawing
Protocols
Caching
Security
Drawing2D
Printing
Text
Configuration
SessionState
Imaging
System.Data
System.Xml
ADO.NET
SqlClient
XmlDocument
Serialization
Design
SqlServerCe
Xslt/XPath
Reader/Writers
System
Collections
IO
Configuration
Runtime
InteropServices
Security
Net
ServiceProcess
Remoting
Text
Reflection
Diagnostics
Serialization
Globalization
Resources
Threading
12.NET CLR Common Features
- Verifiable type safe execution
- No uninitialized variables, unsafe casts, bad
array indexing, bad pointer math - Garbage Collection
- No ref-counting, no leaks
- JIT compilation
- Error handling with exceptions
- Common type system
- Call, inherit, and source-level debug across
different languages
13.NET CF CLR Differences
- COM Interop
- Good support for calling native DLLs
- Support for calling a COM object through DLL
wrappers - No 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 serialization
- Datasets can be serialized to XML
- Subsets of other areas of functionality
14Agenda
- .NET CF vs .NET Framework
- Major Areas
- Base Classes
- Drawing/Forms
- Data/XML
- Web Services
- Application Development
- Emulation and deployment
- Communication and data
- Security
15Basic Data Types
- 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
16Networking
- Sockets
- Synchronous and asynchronous
- Multiple protocols
- Streams
- Built on top of sockets
- Synchronous andasynchronous
- HTTP request and response
- Use stream model
Applications
.NET Compact Framework
Web Services
HTTP Request/Response, Network Stream
Sockets
Common Language Runtime
17Threading
- Applications start with an initial thread
- Applications can start new threads
- Using threads
- Responsive UI
- Program function segregation
- Thread synchronization primitives
18Globalization
- Culture-correct string comparison
- Calendar math
- DateTime and numeric formatting /parsing
- External data
- Encodings
- .NET CF CLR is fully globalized
19Windows Forms Support
- Layout
- Manual positioning
- Drawing
- Polygons, lines, arcs, ellipses, rectangles
- JPEG, BMP images
- Text and images
- TrueType bitmap fonts
- Most desktop controls
- Designer support
20Supported Controls
MainMenu NumericUpDown Panel PictureBox ProgressBa
r RadioButton
- Button
- CheckBox
- ComboBox
- ContextMenu
- DataGrid
- DomainUpDown
- FileOpenDialog
HScrollBar ImageList Label ListBox ListView FileSa
veDialog
StatusBar TabControl TextBox Timer ToolBar TreeVie
w VScrollBar
GroupBox
RichTextBox
NotificationBubble Print Controls
- Unsupported controls not available in CE
HelpProvider LinkLabel NotifyIcon
ToolTip Splitter FontDialog
CheckedListBox ColorDialog ErrorProvider
21Data
- ADO.NET
- DataSet
- Databound controls
- Managed providers
- SQL Server for Windows CE
- SQL Server (remote connection)
22XML
- XmlTextReader and XmlTextWriter
- Forward-only parsers of XML data
- Better performance, no in-memory caching
- Low memory requirements
- XmlDocument
- Parse entire document
- In memory traversal
- Higher memory requirements more functionality
23Unsupported XML Classes
- XmlDataDocument
- Relational and hierarchical views of XML
- XPath
- Query over unstructured XML data
- XSLT
- Transform XML data to other forms
- XML Validation
- Verifies correctness of XML document
24Web Services For Devices
- Web Services
- Synchronous and asynchronous invocation
- HTTP/SOAP
- Support calling into web services
- Why?
- Rich local UI
- Aggregate services
- Cache data locally for offline use
- Important considerations
- Bandwidth (How much? 802.11 or WWAN?)
- Use suitable subset of types
25Agenda
- .NET CF vs .NET Framework
- Major Areas
- Base Classes
- Drawing/Forms
- Data/XML
- Web Services
- Application Development
- Deployment and emulation
- Communication and data
- Security
26Application 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
27Framework Size
- Framework size (RAM or ROM)
- 1.5 MB
- Running RAM needs
- 0.5 MB (depends on app)
- Typical application sizes
- 5 - 100 KB
- Apps often smaller due to use of platform
features in the framework
28Emulation
- 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
29Active Sync Replication
Windows Forms
Service
ADO.NET
ADO.NET
ActiveSync File Replication
DataSet XML
DataSet XML
.NET Compact Framework
.NET Framework
- Cons
- Bound to single PC for data transfer
- No synchronization model works best with flood
synchronizing
- Pros
- Good for casually connected applications
- Back end agnostic
- Local caching for offline
30Direct Database Access
Windows Forms
SQL Server
ADO.NET Data Provider
ADO.NET
.NET Compact Framework
Windows Server
- Cons
- Must be constantly connected
- Not scalable on server classic two tier design
- No synchronization model for typical dynamic data
- Pros
- Rich query into a large data source
- Access to entire data source device queries for
and uses whats relevant
31Web Service Application
Windows Forms
ASP.NET
XML Web Service
ADO.NET
WS Client
Database
Local Data
.NET Framework
.NET Compact Framework
- Cons
- Complex state and synchronization logic gets
unwieldy - Carries bulk of XML data transfer
- Pros
- Well deployed infrastructure (HTTP)
- Information cached Synchronization logicon
server - Device communicates directly with sourceno PC
bridge
32SQL CE With Replication
Windows Forms
SQL Server
ADO.NET
SQL CE Replication (HTTP)
SQL CE
.NET Compact Framework
Windows Server
- Cons
- Server configuration required
- Engine footprint on device
- Pros
- Very robust local store
- Complex SQL querying
- Advanced/performant synchronization
- Utilizes HTTP
33Web Service with SQL CE
Windows Forms
ASP.NET
XML Web Service
ADO.NET
WS Client
Database
SQL CE
.NET Framework
.NET Compact Framework
- Cons
- Carries bulk of XML data transfer
- Mapping of XML to SQL CE
- Footprint considerations
- Pros
- Well deployed infrastructure (HTTP)
- Information cached
- Structured storage
- Secure storage ofsensitive information
34DataSets 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
35Data Providers
- Providers included with .NET CF
- System.Data.SqlClient
- System.Data.SqlServerCe
- Custom Data Providers
- Follow interfaces to provide connection to custom
data sources - Developer creates custom code translating remote
structure to DataSet
36Security
- While transferring data
- HTTP authentication
- Secure sockets
- No encryption for System.Data.SqlClient
- While persisting data
- SQL Server CE
- Devices have the habit of disappearing design
for it - No caching of passwords
- Encrypt sensitive data SQL Server CE
37When to choose?
- Windows CE .NET
- Supports 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 well
- Leverage PInvoke
- http//msdn.microsoft.com/library/en-us/dncenet/ht
ml/choose_api.asp
38Summary
- 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
2003 - Internet
- http//msdn.microsoft.com/vstudio/device
- http//gotdotnet.com/team/netcf/
- msnews.microsoft.com
- microsoft.public.dotnet.framework.compactframework
39(No Transcript)