Embed
Email

mobile

Document Sample
mobile
Shared by: HC11111100911
Categories
Tags
Stats
views:
9
posted:
11/10/2011
language:
English
pages:
88
Intro to

Mobile Development

using .NET



Roberto Brunetti

roberto@devleap.it -rob@thinkmobile.it

http://blogs.devleap.com/rob

http://thinkmobile.it



www.devleap.it

Chi siamo

• www.devleap.it

• Un gruppo di 5 persone

• Studiare a fondo le tecnologie

• Capire il “behind the scenes”

• Implementare soluzioni reali

• Confrontarsi con le problematiche reali

• Sperimentare nuove idee

• Facciamo Corsi, Conferenze, Training

• Scriviamo libri

• http://www.devleap.it/fullcontact





www.devleap.it

DevLeap Pure .NET Training

Introduction to .NET

Core .NET Framework

Framework







Introduction to Introduction to Introduction to

ADO.NET ASP.NET Web Services





Core

Core ADO.NET Core ASP.NET

Web Services





Intro to ASP.NET 2.0 SOA Services

Mobility Dev Preview/Core/Upgrade with WSE2





Advanced Architecting Apps

Mobility Dev in .NET





www.devleap.it

DevLeap Training

Introduction to Data Warehouse SQL Server Reporting

ASP.NET e DTS Services





Sharepoint 2003 OLAP Analysis VSTS

Development Services for Technicians





WinFX WPF (Avalon)

SQL 2005 Preview

Preview Preview



Longhorn WCF (Indigo) SQL 2005 Analysis

Preview Preview Services Preview









www.devleap.it

ThinkMobile.it

• Il 12/7/2005 ho aperto il sito

• Obiettivo: creare la comunità italiana per lo

sviluppo in .NET su dispositivi Mobile

• .NET Compact Framework

• SQL Server for Windows CE

• Repliche dei dati

• Applicazioni Server-side





• Blogs – Forum







www.devleap.it

.NET Clients









www.devleap.it

Windows CE

• Sistema Operativo Real-time e Modulare

• Si possono scegliere le componenti per creare un device

• 3.0

• pIE 3, Supporto Ethernet, IIS, ASP, MSMQ

• Gli OEM hanno aggiunto

• Bluetooth, 802.x, Fingerprint

• 4.x

• pIE 5.5

Bluetooth, 802.x

• IE 5.5, WMT 8.0, Direct X 8.0

• Kerberos, SSL, SmartCard

• 5.x (Magneto)

• Real Time reale

• Miglioramenti di performance su Network e grafica

• Direct 3D Mobile





www.devleap.it

Varie forme consumer

• Handheld PC

• CE 2.0 – versione Pro applicazioni 3.0

• Pocket PC 2000 (3.0)

• CE 3.0

• Pocket PC 2002

• CE 3.0 con nuova shell

• Pocket PC 2003 / SmartPhone 2003

• CE .NET 4.x

• Automazione industriale

• Stanno arrivando dispositivi basati su Windows

Mobile 5.0



www.devleap.it

Devices









www.devleap.it

Pocket PC

• Ne esistono 4 versioni

• Pocket PC 2000 (anche detta 3.0)

• Pocket PC 2002 (CE 3.0)

• Pocket PC 2003 (CE 4.x) – Windows Mobile 2003 for Pocket PC

• Windows Mobile 5.0 for Pocket PC

• Interfaccia

• Pen e Keyboard on-screen (SIP)

• Touch Screen

• Ogni produttore può inserire Hw

• Lettore Bar Code

• GPS integrato

• Applicazioni Custom

• Guscio custom

• ...nei ristoranti...







www.devleap.it

Hardware

• ROM: 32 – 48

• RAM: 32 – 64 - 128

• Processore (da 206 a 700 Mhz)

• StrongARM, Intel PXA 250, Texas OMAP 710

• Add-on

• Compact Flash

• SD Slot

• Infrared - USB – Serial

• Bluetooth

• Jacket di espansione

• Per PCMCIA (PCCard)





www.devleap.it

Per le demo con Pocket PC

• Add-on kit per Pocket PC

• Scheda VGA per proiezione esterna

• Cavo di connessione con proiettore

• Oppure wireless (con proiettore wireless)

• CE Remote Display

• Comodo per sviluppare (Tastiera/Mouse)

• Developer Power Toys

• Come sopra ma senza client

• SOTI Pocket Controller

• Uno spettacolo !





www.devleap.it

Pocket PC 200x Applications

• Connettività • Internet Explorer

• [Modem] • HTML 3.2

• [Scheda Wireless] • XML

• [Bluetooth] • WAP 1.2.1

• [Ethernet] • JScript

• VPN (PPTP) • SSL

• Terminal Services • ActiveX

• ActiveSync • MSN Instant

• “Office” Messenger

• Inbox (e-mail) • Windows Media Player

• Contacts, Calendar, • Locale e Streaming

Tasks, Notes

• Excel, Word

• Reader



Esposte come DLL o ActiveX



www.devleap.it

Pocket PC Phone Edition

• Integra il PocketPC con il telefono

• Nasce dal PocketPC 2002

• Pen-based e tastiera on-screen

• Touch-Pad per la composizione

• 32 - 64 Mb ROM

• 32 - 128 Mb RAM

• Processore ARM-based

• Infrared

• SD slot





www.devleap.it

Pocket PC Phone Edition

• Applicazioni del Pocket PC 200x

• SIM

• SIM Manager

• Contatti SIM (Address Book)

• SMS

• Conference Call

• Auricolare

• Multitasking: si può lavorare con le applicazioni mentre

si telefona







www.devleap.it

Smartphone 200x Hardware



• Processore 120MHz ARM

• 8MB+ RAM

• 16MB Flash ROM

• 176x220 16-bit display

• SD Slot

• No Compact Flash

• E’ un telefono

• No touch-screen

• No Stylus









www.devleap.it

Smartphone 200x Applications

• Telefonia! • Internet Explorer

• Tastierino on-screen • HTML 3.2

• Profile • XML

• Shortcut • WAP 1.2.1

• GPRS • JScript

• Tri-band • SSL

• ActiveSync • MSN Instant

• Pocket Outlook Messenger

• Inbox (e-mail, v-mail, • Windows Media Player

sms) • Locale e Streaming

• Contacts

• ActiveSync

• Calendar

• Tasks



Esposte come DLL o ActiveX



www.devleap.it

SP Internet Explorer

• HTML 3.2

• No Frames

• HTML 4.0 – innerText, innerHTML, accesskey

• No Style Sheets

• WAP 1.2.1

• Microsoft JScript® 1.1

• cHTML (i-Mode)

• accesskey, tel: URL

• XML / XSL

• Microsoft ActiveX® controls

• SSL security

• Imagini: JPEG, GIF, PNG, BMP, 2BP, XBM, WBMP





www.devleap.it

SP Supporto WAP

• Integrazione con HTML Viewer

• WML, WBXML, WML Script, WTLS security

• Bearer (Portante)

• IP, SMS (WAP Push, SI/SL)

• WTAI (Wireless Telephony Application Interface)

• SmartPhone consente MakeCall

• Le caratteristiche non sono adatte allo SmartPhone e

non sicure









www.devleap.it

ROM vs RAM

• ROM

• Sistema Operativo

• Aggiornabile per upgrade del S.O.

• RAM

• Per far girare le applicazioni

• Per Storage “permanente”

• Tranne Hard Reset

• Tranne esaurimento batteria tampone

• Sul Pocket PC Off non significa Reset

• Viene mantenuta la RAM

• Le applicazioni restano nel loro stato

• No Virtual Memory







www.devleap.it

ActiveSync

• Per controllare la Sincronizzazione

• Calendario, Task, Email, Note

• Per passare dati e convertirli

• Word, Excel, Powerpoint

• PDF (da Adobe)

• File Audio/Video





• Ogni applicazione può montare il filtro di

conversione

• Funge anche da Gateway



www.devleap.it

ActiveSync

• Per controllare la Sincronizzazione

• Calendario, Task, Email, Note

• Per passare dati e convertirli

• Word, Excel, Powerpoint

• PDF (da Adobe)

• File Audio/Video





• Ogni applicazione può montare il filtro di

conversione

• Funge anche da Gateway



www.devleap.it

Scenari Applicativi

• Utilizzo di Terminal Service

• Impatto zero sul Device

• Solo per Pocket PC

• Utilizzo di Internet Explorer

• Impatto zero sul Device

• Applicazione sul Device (Oggi)

• Installazione sul Device

• Semplice o complessa che sia

• Scenari

• Utilizzo Socket o Web Request - Vecchio stile

• Utilizzo di XML - Vecchio Stile

• Utilizzo di Web Service !!!

• Download e uso dei dati sul device !!!







www.devleap.it

Piattaforma client

• LapTop / Tablet PC

• VB 6, VC++, .NET

• Driver C++

• Pocket PC 2000/2002

• eVB 3.0, eVC++ 3.0, .NET

• Driver eVC++

• HPC e Palm PC (vecchi)

• eVB 3.0, eVC++ 3.0

• SmartPhone 2002

• eVC++ 3.0 (per adesso)

• CE.NET (4.x) – Pocket PC 2003 / Smartphone 2003

• eVC++ 4.0 (Pocket PC 2003 occorre SP2)

• .NET

• 2003 Second Edition

• Aggiornare immagini emulatori

• Windows Mobile 5

• Emulatore incluso in VS 2005

• Aggiungere Pocket PC / SmartPhonoe









www.devleap.it

Scelte accesso ai dati

Browser



WAP, HTML ASP.NET,

Mobile Browser ecc. Mobile Controls

Presentation Layer



1. XML Web

Service

.NET Compact XML Web

Framework Service

Smart client









4. ADO.NET

Dati Locali 2. Accesso SQL Server



SQL Server CE SQL Server

3. Sincronizzazione

(http)

Windows CE Windows Server



www.devleap.it

Sviluppo Smart Client









www.devleap.it

Windows CE

• Può girare su diversi processori

• ARM / Strong ARM / ARM v4

• MIPS

• Intel PXA (visto come ARM)

• SH3

• X86Em





• Controlli/DLL/Librerie sono diverse per ogni

architettura







www.devleap.it

Platform SDK

• Ogni piattaforma ha il suo SDK

• Pocket PC SDK - Pocket PC 2002 SDK

• SmartPhone SDK – SP 2003 SDK

• Windows CE.NET SDK

• Pocket PC 2003

• Contengono

• Librerie sorgenti, esempi, emulatori, documentazione

• Strumenti utili (Process Viewer…)

• Librerie Binary (DLL)

• Per ogni processore...

• Sono gratuiti





www.devleap.it

Platform SDK

• Si trovano in

• C:\Program Files\Windows CE

Tools\Common\Platman\bin[\wce420]

• Visual Studio (Remote Tools da SDE Project)

• Configurare la connessione

• TCP

• Via rete o ActiveSync

• ActiveSync

• Più semplice





• Cosa c’è ? …



www.devleap.it

Platform SDK Tools

• CEFilevw.exe (File Viewer)

• Meglio File Explorer di ActiveSync

• CEHeapWk.exe (Heap Walker)

• CEPerfMon.exe

• CEPView.exe

• CERegEdit.exe

• CESysInfo.exe

• CEZoom.exe

• KernelTracker.exe

• Msic.exe (Remote Call Profiler)



www.devleap.it

.NET

• I compilatori producono MSIL/CIL (Common

Intermediate Language) (exe o dll)

• Identico alla versione “Desktop”

• CIL è standard

• Alla prima esecuzione il Runtime .NET esegue una Just-

in-time Compilation

• Il codice binario prodotto viene cachato per usi seguenti

• Il codice IL (exe o dll) è “portabile”

• Anche da Device a Desktop e viceversa

• Il Runtime .NET CF e’ specifico

• Sul Desktop si può decidere di produrre l’immagine nativa

con NGEN

• Sui Device per adesso NO





www.devleap.it

Execution Engine Overview

• Type safe execution

• No variabili non inizializzate, no cast unsafe, no indici Out Of

Range

• Garbage collection

• JIT compilation

• Error handling con gestione eccezioni

• Common Type System

• Chiamate e ereditarietà cross-language

• Platform Invocation

• XML

• Client Web Service





www.devleap.it

Memorizzazione

• Utilizza RAM

• Fino al limite indicato nel Control Panel

• Per strutture dinamiche e JIT-compiled code

• Se la RAM scarseggia…e la papera non ….

• Utilizza ROM

• Memorie Flash

• Disk storage se presente









www.devleap.it

Classi 1.0









www.devleap.it

Visual Studio 2005

• Visual Basic .NET e Visual C# .NET

• Caratteristiche

• Template per Device

• Designer e Editor

• Help e Esempi

• Emulatore incluso

• Debug Remoto sul device

• Compilazione

• Installazione di applicazioni diretta

• Comprende .NET CF SDK

• C:\program files\VS.NET\CompactFW SDK









www.devleap.it

Remote Debugging

• Identico al desktop

• Compila

• Esegue il Deploy sul Device o sull’emulatore

• Messaggi nell’Output Window

• Caratteristiche

• Debug remoto sul device

• Breakpoint

• Debug multi-linguaggio

• Call Stack

• Watch Window

• Command Window – Immediate





www.devleap.it

Accesso ai dati



Due cenni storici









www.devleap.it

Data Access – Ieri



Inbox Contacts







eVC 2.0 eVB 2.0







ADO CE v2.0 Active

ODBC

Replication, Sync

QP





CEDB/PegDB API Jet









www.devleap.it

OLEDB Providers - CEDB



MS Access

VB CE VC++ CE





ADO CE



OLEDB CE

ODBC



Query Replication

Processor Tracking



CEDB/PegDB API Active Sync









www.devleap.it

Architettura..nel 2000



• Windows LIKE

• eVC e eVB per lo sviluppo

• ADOCE per l’accesso ai dati

• 3.0 Nativa su Pocket PC / CE 3.0

• 3.1 da installare

• OLEDBCE a basso livello









www.devleap.it

Data Access Fine 2000

• ADOCE 3.1

eVB 3.0 • Parla OLEDBCE

eVC

ADO

Active X 3.0 • ADOX

CE

• OLEDBCE

Objects

v3.1



OLEDB CE

• Abilita i provider sul CE

• SQL Server for CE 1.0

SQL Server For CE

• Si elimina ActiveSync

OLEDB

dallo scenario “Dati”

QP/Cursor Engine/ES

• Dando spazio a Http

OLEDB



Storage Engine / Repl Tracking







www.devleap.it

Data Access Storage Architecture pre

.NET

eVB 3.0

eVC

ADO

Active X 3.0

CE Objects

v3.0



OLEDB CE





SQL Server 2000 Windows CE Edition





OLEDB

Server

Agent:

QP/Cursor Engine/ES Client

Replication

Agent: IIS and

Replication HTTP

OLEDB Remote

Data Access

Storage Engine / Repl Tracking

CLIENT SERVER









www.devleap.it

Con .NET

.NET CF / Managed Stack

VS .NET (VB.NET, C#)

Native/Unmanaged Stack

eVB ADO.NET Ethernet



3.0 SQL Server

eVC SQL Server CE Client Data

TDS

ADO 3.0 Data Provider Provider

CE Scenario

v3.1 CLR / .NET CF Connesso

OLEDB CE

OLEDB / Replication

802.11b, API

SQL CE Edition v2.0 Data Provider CDPD, GSM,

CDMA,

OLEDB TDMA, etc. Server

Client

Agent:

QP/Cursor Engine/ES Agent:

Replication

Replication IIS and

and

OLEDB HTTP Remote

RDA

Data Access

Storage Engine / Repl Tracking Scenario

Disconnessos

www.devleap.it

CLIENT SERVER

Campeggi

• Connesso

• Accesso diretto a SQL

• Disconnesso

• Download dati

• Aggiornamento locale

• Sincronizzazione con RDA









www.devleap.it

Accesso Diretto a SQL Server

• Esecuzione Stored Procedure

• Utilizzo di DDL

• Transazioni

• Utilizzo di SqlDataReader

• Utilizzo di SqlDataAdapter

• Utilizzo di cmd.ExecuteXmlReader con la clausola

FOR XML di SQL









www.devleap.it

ADO.NET Diretto su SQL Server

• Identico al “DeskTop”

• Namespace System.Data.SqlClient

• Disponibili tutte le classi “DeskTop”

• SqlDataReader

• SqlDataAdapter

• SqlCommand

• SqlParameter

• Namespace System.Data

• DataSet









www.devleap.it

SQL Server For Windows CE

(SQLCE)









www.devleap.it

SQL Server CE

• Compatibilità con SQL Server

• Stesso Resultset

• Data Type Compatible

• Footprint

• ~700kb per CPU X86

• Disponibile

• Windows CE 2.11 e successive

• Usato nativamente o replicando da SQL









www.devleap.it

Cos’é?

• OLEDB Provider

• Non proprio conforme alle specifiche OLEDB

• E’ un database con un DLL wrapper

• In CE non esistono i servizi

• Supporta ADOCE

• Supporta OLEDB CE API

• Supporta ADO.NET del .NET CF









www.devleap.it

Database Feature 1.x

• Multi-column indexes • Data-types

• Real, Numeric, NVarChar,

• Referential integrity NText, Image, Integer,

• Sub-selects (IN) DateTime, VarBinary,

UniqueIdentifier, Money

• Default

• Having/group by

• Inner/outer join • Seek on index

• 32 index per table • Set functions

• One file database • Identity attribute

• TCO support

• Null support

• Local security - DB encryption

• Unicode support (128bit) and database

• Transaction password









www.devleap.it

2.0 Features

• Union

• SELECT * FROM A UNION SELECT * FROM B

• Intrinsic Function (CASE, @IDENTITY)

• Query parametriche

• INSERT INTO mytable (col1, col2) VALUES (?, ?);

• Index Pull

• Recupero indici durante scaricamento con RDA

• Connectivity Setup Wizards

• Setup più semplice

• Optional Error Strings

• DLL per messaggi errore

• ISQLW CE piú visuale







www.devleap.it

SQL 2005 Mobile

VS .NET (VB.NET, C#)

XML/BizTalk/CS 2002/DTS



Managed SQL CE + eDB Apps



System.Data.SqlClient (160KB)

System.Data.SqlServerCe (140KB)

TDS

System.Data.Common (124KB)





OLE DB

OLEDB / Replication

sqlceoledb30.dll (200KB)





Internal QP API Server

Agent:

QP Replication HTTP Replication

sqlceqp30.dll (800KB)

and IIS and

RDA Remote

Data Access

eDB API

Internal SE API sqlceca30.dll (360KB) sqlcesa30.dll (150KB)

sqlcerp30.dll (100KB)

Storage Engine



eDB – sqlcese30.dll (300KB) CLIENT

www.devleap.it SERVER

2005 Storage Engine

• Riscritto totalmente

• Multi-User support

• Row level locking data

• Page level locking index

• Lock Escalation

• Stabilità

• ACID Transaction

• Auto re-use di pagine vuote

• Non necessario Compact







www.devleap.it

2005 Query Processor

• Cost-Based Optimization

• QP usa piani Cost-based

• QP usa le statistiche dello storage engine

• Execution Plan e Query Hints

• Come in SQL 2000: Analisi e correzione query

• SqlCeResultSet

• Accesso via Scrolling

• Accesso Random

• Update

• Parametri Named



www.devleap.it

SQL Server 2005 Management Studio

• Connessione a SQL Server o SQL Mobile

• Funzionalità identiche

• Object Explorer

• Query Editor

• Management Dialog

• Connessione a DB

• Sul desktop o direttamente sul Device

• Query Plan e Hint

• Subscription Wizard

• Supporto SSIS (ex DTS)

• Creare SQL Mobile DB

www.devleap.it

Demo SQL 2005

• Registered Server di tipo Sql Mobile

• Su DeskTop (SqlMobile\TestDB\Test.sdf)

• Su Device (Browse...)

• Connect -> Object Browser

• New Table / Column / Index

• Views – Programmability (Type)

• Replication Subscription per Merge Repl

• Connect -> New Query

• SqlMobile\TestDB\QueryPlan.sqlce







www.devleap.it

VS 2005 Create SDF









www.devleap.it

Integrazione con .NET CF

• System.Data.SqlServerCE

• Esponde tutte le funzionalitá SQL CE

• SqlCEDataReader

• SqlCEDataAdapter

• SqlCECommand

• SqlCEParameter

• Utilizzo di Try/Catch

• System.Data.SqlServerCe.SqlCeException

• Utilizzabile stand-alone

• Demo

• Cerca in locale

• Aggiorna locale







www.devleap.it

SqlCeConnection

• “Provider=Microsoft.SQLServer.OLEDB.CE.1.0;Da

taSource=\directory\file.sdf”



• .Open

• .Close



• SQL CE 2.0 non supporta connessioni

contemporanee !!!

• SQL 2005 Mobile si







www.devleap.it

Classi di accesso

• SqlCeAdapter

• SelectCommand

• UpdateCommand

• DeleteCommand

• InsertCommand

• Deriva da System.Data.Common.DbDataAdapter

• Come gli altri adapter desktop

• SqlCeDataReader

• Analogo al SqlDataReader









www.devleap.it

Creazione di .sdf da codice

try

{

SqlCeEngine sqlEngine =

new SqlCeEngine("Data Source=\Pippo.sdf”);

sqlEngine.CreateDatabase();

}

catch (SqlCeException ex)

{

ShowErrors(ex, "Impossibile creare il db locale");

}









www.devleap.it

Query Parametriche

cmd.CommandText = “ INSERT INTO Articoli

(IdArticolo, Articolo) VALUE(?, ?)”

cmd.Parameters.Add(“@IdArticolo”,

System.Data.SqlDbType.Char, 10)

cmd.Parameters[“IdArticolo”].Value = “ABC”





cmd.ExecuteXXX()







www.devleap.it

SqlCeDataReader

• Fornisce funzionalità di accesso read-only e

forward-only su uno stream di record ritornati

dall’esecuzione di un comando sul database

• Viene creato a partire da un oggetto

SqlCommand

• Il metodo Read legge la prima riga e le

successive nello stream fino al termine

• Ritorna false al termine del result set

• Un solo record alla volta in memoria

• Aumenta performance e scalabilità delle applicazioni





www.devleap.it

Sincronizzazione

• Due metodologie

• RDA – Remote Data Access

• SQL Server 6.5 Service Pack 5 +

• Merge Replication con SQL 2000

• SQL Server puo’ fare da ponte verso altri

database

• Utilizzando i Linked Server

• L’utilizzo di tabelle locali ha comunque senso per

ridurre la banda







www.devleap.it

Connectività verso LAN

• Come sempre: Web

• HTTP

• Internet e Intranet

• Sicurezza gestita da IIS

• Authentication (anonymous, basic, NTLM)

• Authorization

• Encryption (SSL)

• Accesso consentito tramite firewall

• Ma

• Compressione per banda ridotta

• Message-based per meno roundtrip





www.devleap.it

Configurazione IIS

• SSCESA20.DLL e’ l’applicazione (estensione)

ISAPI da utilizzare

• Serve Virtual Directory con permesse Execute

• SQL Server CE Connectivity Management

• Configura Virtual Directory

• Sicurezza IIS

• Sicurezza ACL sulla cartella









www.devleap.it

Replication

• SQL Server 2000 merge replication

• Device connessi occasionalmente

• Integrazione SQL Server 2000

• Compatible Merge Replication Control

• Supporta il mapping dei data type

• Sincronizzazione diretta con il server

• Anonymous pull subscription









www.devleap.it

Connectivity – Replication





CLIENT SERVER



SQL Server SQL

SQL Server Replication DB

SSCE SSCE Provider

I Reconciler

Client I Server

Appl Agent

Agent S SSCE

Replication

Provider







SSCE

DB .IN .OUT







www.devleap.it

Remote Data Access

• Se il device è connesso “spesso”

• Dove la Merge Replication non è necessaria

• Dove la Merge Replication è troppo pesante

• Per avere più controllo da codice

• Elimina la necessità di un Desktop

• Accesso a SQL Server 7.0 e 2000

• Download to device e disconnessione

• Tracking anche disconnesso







www.devleap.it

Remote Data Access

• Download dati clienti e piazzole

• Disconnessione

• Giro delle piazzole per controllo

• Per “irregolarità” o modifiche

• Tabella Piazzole

• Tabella Segnalazioni

• Connessione

• Sincronizzazione dei Dati









www.devleap.it

RDA: Metodi

• Pull

• Porta i dati sul device

• Selezione via statement SQL

• Viste / Stored Procedure / Query SQL

• Creazione tabelle locali

• Push

• Invia le modifiche al server

• Submit SQL

• Invio diretto di SQL DML









www.devleap.it

Inizializzazione

• Dim x = New SqlCeRemoteDataAccess

• x.InternetLogin = “”

• x.InternetPassword = “”

• x.InternetUrl = “x.com/sqlce/sscesa20.dll”

• x.LocalConnectionString

• x.InternetProxyServer









www.devleap.it

Pull

Object.Pull

(

“tabella locale”,

“statement sql”,

“oledb connection usata lato server”,

[RdaTrackOption],

[“tabella segnalazione errori”]

)









www.devleap.it

Push

Object.Push

(

“tabella locale”,

“oledb connection usata lato server”,

[RdaBatchOption]

)









www.devleap.it

BatchingOn

SET IMPLICIT_TRANSACTIONS ON



declare @P1 int

set @P1=1

exec sp_prepexec @P1 output, N'@P1 int,@P2 int,@P3 bit,@P4 varchar(50)',

N'INSERT INTO "SEGNALAZIONI"("IdNota", "IdPiazzola", "TipoNota",

"Nota") VALUES (@P1, @P2, @P3, @P4)', 1, 1, 0, NULL



select @P1



// Lancia tutti i comandi effettuati sulla tabella

exec sp_execute 1, 3, 2, 0, 'tutto ok'



// Unprepare dei comandi

exec sp_unprepare 1



IF @@TRANCOUNT > 0 COMMIT TRAN







www.devleap.it

BatchingOff

// Dichiarazione dei comandi di INSERT/UPDATE/DELETE

declare @P1 int

set @P1=1

exec sp_prepexec @P1 output, N'@P1 int,@P2 int,@P3 datetime,@P4

datetime,@P5 int,@P6 int,@P7 int', N'UPDATE "PIAZZOLE" SET

"IdPiazzola" = @P1, "IdCliente" = @P2, "DataArrivo" = @P3,

"DataPartenza" = @P4, "Persone" = @P5, "Tende" = @P6 WHERE

"IdPiazzola" = @P7', 1, 1, 'Jun 16 2003 12:00:00:000AM', 'Jan 1

1900 12:00:00:000AM', 4, 2, 1

select @P1



Lancia tutti i comandi effettuati sulla tabella

exec sp_execute 1, 2, 2, 'May 10 2003 12:00:00:000AM', 'Jan 1 1900

12:00:00:000AM', 1, 1, 2



// Unprepare dei comandi

exec sp_unprepare 1





www.devleap.it

SubmitSql

Object.SubmitSQL

(

“statement sql”,

“oledb connection usata lato server”

)







Demo Campeggi

N.B. Non si usa se connessione diretta

Utilissimo se connessione Http





www.devleap.it

Gestione Eccezioni SQLCE

• Classe SqlCeException

• Espone collezione Errors

• For Each err in SqlCeException.Errors

• err.HResult.ToString(“X”)

• err.Message

• err.NativeError

• err.Source

• err espone anche NumericErrorParameters

• Collezione di string









www.devleap.it

Eccezioni in Push

• Per ogni conflitto o problema

• Viene utilizzata (se specificata) la tabella locale

indicata come tabella di errore

• A fronte di una eccezione si possono analizzare i

record

• Utilizzando ADO.NET direttamente sulla tabella









www.devleap.it

RDA VS Merge

• RDA e’ piu’ semplice da implementare

• RDA tiene traccia solo delle modifiche locali,

Merge anche delle modifiche server-side

• Merge richiede piu’ spazio sul device

• RDA richiede che le tabelle vengano cancellate

prima di recuperare i dati

• RDA necessita di una chiamata per ogni Pull e

una per ogni Push

• RDA supporta anche SQL 7 (e 6.5)

• Possono essere usate in tandem



www.devleap.it

Supporto connettivita’

• Ethernet

• Wireless

• In generale e’ indipendente

• Sfrutta qualunque modalita’ di comunicazione del

Device

• Anche ActiveSync puo’ fare da ponte per la LAN

• La versione 3.5 nativamente

• La versione 3.1 richiede SQLCE Relay Agent

• Impostare InternetProxyServer









www.devleap.it

Considerazioni

• Identificare i dati da sincronizzare

• Scaricare solo quello che serve

• Capire la frequenza di sincronizzazione

• Ogni utente sincronizza in modo indipendente

• Implementare logica di risoluzione conflitti









www.devleap.it

Limiti di RDA

• Pull crea le tabelle

• Non è incrementale

• Campi Identity

• Master Detail

• Logica Business su diversi record



• Facciamo due chiacchere









www.devleap.it

RDA vs Merge

• RDA

• Più leggera

• Ottima se aggiornamenti non frequenti

• Merge

• Più completa

• Overhead maggiore

• Si usa se già in piedi :-)



• http://msdn.microsoft.com/library/en-

us/dnppcgen/html/eff_arch_sql_servr_ce_rep.a

sp





www.devleap.it

Windows Mobile 5.0



Abbiamo tempo ?









www.devleap.it

Facciamo un giro Live

• Talk

• SMS Send

• Aggiornamento Contatti

• Aggiornamento Calendario

• Ricezione SMS

• SNAPI









www.devleap.it

Altre Informazioni

• Dove posso ottenere maggiori informazioni

• www.devleap.it

• www.pocketpcdn.com

• www.thinkmobile.it





• Developer resources

• Microsoft Visual Studio

• Microsoft .NET Framework SDK

• Microsoft Developer Network









www.devleap.it

Mobile Dev



I vostri feedback sono

importanti

• Scriveteci









Grazie della partecipazione

– A presto

– Info@DevLeap.it









www.devleap.it


Related docs
Other docs by HC11111100911
vbdotnet
Views: 0  |  Downloads: 0
sapdict
Views: 0  |  Downloads: 0
C Chapter 20 20three
Views: 0  |  Downloads: 0
Web20
Views: 1  |  Downloads: 0
presentationforASNY 110906
Views: 0  |  Downloads: 0
Management 20HR 20The 20Home 20Depot 20Proj
Views: 0  |  Downloads: 0
FH 20Carrier 20Code 20List 20Numeric 201 10
Views: 1  |  Downloads: 0
rules_CeLI_Life
Views: 0  |  Downloads: 0
Website 20Inidv 20 20MbrPaid
Views: 7  |  Downloads: 0
Moore
Views: 3  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!