View
215
Download
0
Tags:
Embed Size (px)
Citation preview
Occasionally Connected Occasionally Connected Smart ClientsSmart Clients
Steve LaskerSteve LaskerProgram Manager Program Manager Visual StudioVisual StudioMicrosoft CorporationMicrosoft Corporation
[email protected]@Microsoft.comblogs.msdn.com/SmartClientDatablogs.msdn.com/SmartClientData
2
What Is: Occasionally What Is: Occasionally ConnectedConnected
Empowering users to leverage their computer, Empowering users to leverage their computer, applications, data and files regardless of network applications, data and files regardless of network availabilityavailability
Application proactively retrieves necessary data Application proactively retrieves necessary data necessary to work offlinenecessary to work offline
As the network comes available, the application As the network comes available, the application will automatically sync their work and log conflicts will automatically sync their work and log conflicts for the user to resolvefor the user to resolve
Network operations occur in the background so Network operations occur in the background so the user can stay focused on their taskthe user can stay focused on their task
Example: Outlook 2003Example: Outlook 2003
3
AgendaAgenda
Resources for working offlineResources for working offline
Occasionally Connected Systems Occasionally Connected Systems Common ArchitectureCommon Architecture
Demo ScenarioDemo Scenario
Demo ArchitectureDemo ArchitectureDatabase OptionsDatabase Options
Sync OptionsSync Options
Application UpdatesApplication Updates
Running Background Tasks Running Background Tasks Asynchronously Asynchronously
4
Resources Needed OfflineResources Needed Offline
DataDataA subset of the data from the server(s)A subset of the data from the server(s)
Heterogeneous Sync (SQL Server, Oracle, DB2, Heterogeneous Sync (SQL Server, Oracle, DB2, …)…)
FilesFilesNot all data exists within the databaseNot all data exists within the database
Media files, Office Files, …Media files, Office Files, …
Application Messaging (Web Services, WCF, Application Messaging (Web Services, WCF, …)…)
Ability to queue outbound messagesAbility to queue outbound messages
Ability to async process inbound messagesAbility to async process inbound messages
Read Only Informational/Reference Data Read Only Informational/Reference Data ServicesServices
Ability to pre-fetch data from existing servicesAbility to pre-fetch data from existing services
5
Occasionally Connected Smart ClientOccasionally Connected Smart Client
Background Background TasksTasks
Netw
ork
Resou
rces
Netw
ork
Resou
rces Data SyncData Sync
ServicesServices
Data Access APIData Access API
Data StoreData Store
Message Message QueuingQueuing
Message Message CachingCaching
FilesFiles
File SyncFile SyncServicesServices
Microsoft Windows / Windows MobileMicrosoft Windows / Windows Mobile
Vis
ual S
tud
ioV
isu
al S
tud
io
Smart Client Application / UISmart Client Application / UI
Application Application UpdatesUpdates
Canned Canned UI UI
ControlsControls
6
Adventure Works SalesAdventure Works Sales
Field SalesField Sales
Multi-level marketingMulti-level marketingConsumers sell Adventure Works ProductsConsumers sell Adventure Works Products
Need for the app to run disconnectedNeed for the app to run disconnected
Sellers are independentSellers are independentHardware not owned by Adventure WorksHardware not owned by Adventure Works
Many platformsMany platformsBrowserBrowser
DesktopDesktop
Tablet PCTablet PC
Pocket PCPocket PC
Smart PhoneSmart Phone
7
Adventure Works SalesAdventure Works SalesSmart ClientSmart Client
Background Background TasksTasks
Adventure Adventure Works CorpWorks Corp
Adventure Works Sales Adventure Works Sales ArchitectureArchitecture
Netw
ork
Serv
ices
Netw
ork
Serv
ices
SyncSyncServicesServices
Data StoreData Store
WeatherWeatherCachingCaching
Order Order SubmissioSubmission Queuen Queue PromoPromo
VideosVideos
App LogicApp Logic
Desktop Desktop TabletPTabletP
CCPocketPCPocketPC Smart Smart
PhonePhone
DataDataServerServer
Syn
cS
yn
cS
erv
icS
erv
ices
es
Ord
er
Ord
er
Serv
icS
erv
ices
es
WeatheWeatherr
ServiceServicess
•Product Catalog•My Customers•Order Scratchpad•My Inventory
App App UpdatesUpdates
8
Which Local Data Store?Which Local Data Store?
Microsoft Database TechnologiesMicrosoft Database Technologies
SQL Server 2005SQL Server 2005SQL Server Express Edition SQL Server Express Edition
SQL Server Mobile EditionSQL Server Mobile Edition
Jet Jet (Access)(Access)
Microsoft Visual FoxPro (.dbf)Microsoft Visual FoxPro (.dbf)
ExcelExcel
XMLXML
WinFSWinFS
Something newSomething new
9
SQL Server ExpressSQL Server Express
Great improvements over MSDEGreat improvements over MSDESimple install from web or local MSISimple install from web or local MSI
ClickOnce will BootStrap SSE if not ClickOnce will BootStrap SSE if not installedinstalled
Connect w/File Path Connection Connect w/File Path Connection StringString
User Instance feature for File Path User Instance feature for File Path ConnecitonsConnecitons
Great for VS DevelopmentGreat for VS Development
10
Deploying SSE For Deploying SSE For Occasionally Connected Occasionally Connected ScenariosScenarios
Base Install of SSEBase Install of SSEClickOnce BootstrapperClickOnce BootstrapperRequires Admin RightsRequires Admin Rights
Replication w/SSEReplication w/SSEReplication not supported w/User Replication not supported w/User InstancesInstances
Enable SQL Server AuthenticationEnable SQL Server AuthenticationAdd DBO Privileged AccountAdd DBO Privileged AccountScript creation of databaseScript creation of databaseVerify / Create / Attach database at startupVerify / Create / Attach database at startup
Deploy SQL Server Replication .DllsDeploy SQL Server Replication .Dlls
11
Occasionally Connected Occasionally Connected DevicesDevices
ServersServers
DesktopsDesktops
LaptopsLaptops
Tablet PC’sTablet PC’s
Windows CEWindows CE
Pocket PCPocket PC
Smart PhoneSmart Phone
??
Win 32Win 32Sweet Sweet spotspot
12
Local Database OptionsLocal Database Options
Server
Workgroup
Desktop
Laptop
Tablet PC
Windows CE Device
Pocket PC
Smart Phone
Win 32Win 32
SQ
L S
erve
rE
xpre
ss
SQ
LS
erv
er
Mu
ltiU
ser
Sin
gle
Use
r S
cena
rios
SQ
L M
ob
ile
SQ
L M
ob
ile
13
Deploying SQL Server Deploying SQL Server MobileMobile
SQL Server Mobile EngineSQL Server Mobile EngineAdd runtime dlls to project (sqlce*.dll) Add runtime dlls to project (sqlce*.dll) C:\Program Files\Microsoft Visual Studio 8\Common7\IDEC:\Program Files\Microsoft Visual Studio 8\Common7\IDE
File size <1.4mbFile size <1.4mb
Set files to Set files to Copy to Output Directory = Copy if Copy to Output Directory = Copy if newernewer
ADO for SQL Server MobileADO for SQL Server MobileAdd reference to Microsoft SQL Mobile Add reference to Microsoft SQL Mobile
Located in: Located in: C:\Program Files\Microsoft Visual Studio 8\ _C:\Program Files\Microsoft Visual Studio 8\ _ Common7\Common7\IDE\PublicAssemblies\System.Data.SqlServerCE.dllIDE\PublicAssemblies\System.Data.SqlServerCE.dll
File Size ~224kFile Size ~224k
14
Deploying SQL Server Deploying SQL Server MobileMobile
15
SQL Server Mobile SQL Server Mobile RuntimeRuntime.dll file.dll file FunctionalityFunctionality
sqlcese30.dllsqlcese30.dll SQL Server Mobile SQL Server Mobile Engine. Engine.
sqlceqp30.dllsqlceqp30.dll SQL Server Mobile SQL Server Mobile Query ProcessorQuery Processor. . Required for all SQL Server Mobile applications.Required for all SQL Server Mobile applications.
sqlceme30.dllsqlceme30.dll Required for ADO.net, Required for ADO.net, System.Data.SqlServerCe.dllSystem.Data.SqlServerCe.dll
sqlceer30[language]sqlceer30[language].dll.dll
Contains Contains error strings error strings for SQL Server Mobile-for SQL Server Mobile-generated errors. generated errors. Required for all SQL Server Mobile applications.Required for all SQL Server Mobile applications.
sqlceca30.dllsqlceca30.dll The SQL Server Mobile Client Agent. Required for The SQL Server Mobile Client Agent. Required for applications that connect to SQL Server by usingapplications that connect to SQL Server by using replication replication or or remote data accessremote data access..
sqlcecompact30.dllsqlcecompact30.dll Provides the Provides the compact database compact database functionality. functionality.
sqlceoledb30.dllsqlceoledb30.dll Provides Provides OLE DBOLE DB connectivity to SQL Server Mobile connectivity to SQL Server Mobile databases. Required only if your application uses databases. Required only if your application uses OLE DB to connect to the SQL Server Mobile OLE DB to connect to the SQL Server Mobile database. Used by RDA. database. Used by RDA.
Total File SizeTotal File Size 1.34mb1.34mb
16
How - To Sync How - To Sync
Roll your ownRoll your ownUltimate in flexibilityUltimate in flexibilityHighest cost to develop and maintainHighest cost to develop and maintain
Merge ReplicationMerge ReplicationMost power, broadest features for different data partitions, spans Most power, broadest features for different data partitions, spans all devicesall devicesNeed DBO/DBA privileges, must “own” serverNeed DBO/DBA privileges, must “own” server
Remote Data Access (RDA)Remote Data Access (RDA)Easy entry point for well partitioned data, no config to databaseEasy entry point for well partitioned data, no config to databaseLimited to SQL Server MobileLimited to SQL Server Mobile
TechnologyTechnology Roll your Roll your ownown
MergeMerge
ReplicatioReplicationn
RemoteRemoteData AccessData Access
XML - DataSetsXML - DataSets SQL Server SQL Server ExpressExpress SQL Server MobileSQL Server Mobile
17
Local App
RDA Sync ArchitectureRDA Sync Architecture
Server
Data
SQL Server
Mobile
Database
Engine
DAL
UI
InInOutOut
IIS
w / Sync ISAPI dllRDA Sync
Engine
18
Smart Client
WC
FC
ache
Sales
Fulfillment
Accounting
Inventory
Logic
Sync
Transport
Transport
Logic
LogicRules
LogicRules
LogicRules
LocalDataStore
Rules
WC
FQ
ueue
Controls
Validation Logic*
Logic
Sync
Client
RDA.Pull(“Products", _ "SELECT ProductId, Name, Description, Category, UnitPrice " & _ "FROM Products", _ My.Settings.ServerOleDBConnectionString, _ RdaTrackOption.TrackingOff)
Reference Reference DataData
Product Product CatalogCatalog
RDA: Initializing Reference RDA: Initializing Reference DataData
19
Smart Client
WC
FC
ache
Sales
Fulfillment
Accounting
Inventory
Logic
Sync
Transport
Transport
Logic
LogicRules
LogicRules
LogicRules
LocalDataStore
Rules
WC
FQ
ueue
Controls
Validation Logic*
Logic
Sync
Client
Rda.Pull(“Customers", _ "SELECT CustomerId, Name, Address, Phone, Fax" & _ "FROM Customers", _ My.Settings.ServerOleDbConnectionString, _ RdaTrackOption.TrackinTrackingOngOn)
UpdateableUpdateableDataData
CustomersCustomers
RDA: Initializing Updatable RDA: Initializing Updatable DataData
20
Smart Client
WC
FC
ache
Sales
Fulfillment
Accounting
Inventory
Logic
Sync
Transport
Transport
Logic
LogicRules
LogicRules
LogicRules
LocalDataStore
Rules
WC
FQ
ueue
Controls
Validation Logic*
Logic
Sync
Client
Rda.Push(“Customers", _My.Settings.ServerOleDbConnectionString, _ SyncBatching.BatchingOn)
UpdateableUpdateableDataData
CustomersCustomers
RDA: Pushing Changes BackRDA: Pushing Changes Back
InIn
21
Smart Client
WC
FC
ache
Sales
Fulfillment
Accounting
Inventory
Logic
Transport
Transport
Logic
LogicRules
LogicRules
LogicRules
Incorporating WCF w/RDAIncorporating WCF w/RDA
LocalDataStore
Rules
Controls
Validation Logic*
Logic
Sync
Sync
Client
WC
FQ
ueue
22
Remote Data Access (RDA)Remote Data Access (RDA)
23
Configuring RDAConfiguring RDA
Configure Web Sync PointConfigure Web Sync Point
Write client side codeWrite client side codeDim rda As New SqlCeRemoteDataAccess()rda.InternetUrl = "http://www.YourCompany.com/SqlMobileSync/sqlcesa30.dll"rda.LocalConnectionString = "Data Source =.\AdventureWorksSales.sdf"rda.Pull("LocalTableName", _ "Query To Execture on the Server", _ "OLEDB ConnectionString from Web Server to SQL Server", _ RdaTrackOption.TrackingOnWithIndexes, _ "Local Table for Errors on Push")
Dim rda As New SqlCeRemoteDataAccess()rda.InternetUrl = "http://www.YourCompany.com/SqlMobileSync/sqlcesa30.dll"rda.LocalConnectionString = "Data Source =.\AdventureWorksSales.sdf"rda.Pull("Customer", _ "SELECT CustomerID, Name, FROM Customer ", _ "Provider=SQLOLEDB.1;Data Source=YourSQLServer;" & _ "User ID=YourServerUserName;Password=YourServerPassword;" & _ "Initial Catalog=AdventureWorksSales", _ RdaTrackOption.TrackingOnWithIndexes, _ "Customer_Errors")
24
RDA LimitationsRDA Limitations
Based on Snapshot Based on Snapshot Push, Push, Push, Push, PushPush
Changes at server aren’t pulled down Changes at server aren’t pulled down until next snapshotuntil next snapshot
Limits the Product Catalog scenariosLimits the Product Catalog scenarios
Updates are limited to last client winsUpdates are limited to last client winsComparison based on PK onlyComparison based on PK only
25
App Updates With App Updates With ClickOnceClickOnce
ClickOnce Background API’sClickOnce Background API’s
Imports System.Deployment.Application.ApplicationDeployment... Private Function CheckForAppUpdates() As UpdateCheckInfo If ApplicationDeployment.IsNetworkDeployed Then Dim updateInfo As UpdateCheckInfo updateInfo = CurrentDeployment.CheckForDetailedUpdate() If updateInfo.UpdateAvailable Then ' download the update If ApplicationDeployment.CurrentDeployment.Update() Then ' Update Downloaded End If End If Return updateInfo End IfEnd Function
26
App Updates - ClickOnceApp Updates - ClickOnce
27
BackgroundTasks / StepsBackgroundTasks / Steps
Runs on a background thread of the Runs on a background thread of the applicationapplication
Executes collection of stepsExecutes collection of steps
Start / Stop Start / Stop similar to similar to Windows ServicesWindows Services
Executes in a Executes in a loop based on loop based on a Timera Timer
Can be triggered by Network Can be triggered by Network ResourcesResources
Marshals progress / completed infoMarshals progress / completed infoto UI threadto UI thread
28
Background TasksBackground Tasks
29
SummarySummary
Smart Client AdvantagesSmart Client AdvantagesAbility to work offline Ability to work offline Ability to work on behalf of the userAbility to work on behalf of the user
Leverage, embrace reference dataLeverage, embrace reference dataLeverage Microsoft local data storesLeverage Microsoft local data stores
SQL Server Express Edition SQL Server Express Edition SQL Server Mobile EditionSQL Server Mobile Edition
Build sync APIs as background tasksBuild sync APIs as background tasksComposable Sync APIs are coming…Composable Sync APIs are coming…
Leverage Occasionally Connected Systems Leverage Occasionally Connected Systems Architectures to be well positionedArchitectures to be well positioned
Leverage ClickOnce APIs for updatesLeverage ClickOnce APIs for updates
30
ResourcesResourcesData Designers & Occasionally Connected Systems Discussions:Data Designers & Occasionally Connected Systems Discussions:http://blogs.msdn.com/SmartClientDatahttp://blogs.msdn.com/SmartClientData
Drag Once Databinding:Drag Once Databinding: http://www.Code-Magazine.com/Article.aspx?quickid=0409051http://www.Code-Magazine.com/Article.aspx?quickid=0409051
Drag Once w/Custom Controls:Drag Once w/Custom Controls: http://www.Code-Magazine.com/Article.aspx?quickid=0411071http://www.Code-Magazine.com/Article.aspx?quickid=0411071
Windows Forms: Windows Forms: http://www.WindowsForms.nethttp://msdn.Microsoft.com/WindowsForms/http://msdn.Microsoft.com/WindowsForms/http://forums.Microsoft.com/msdn/default.aspx?ForumGroupID=2 http://forums.Microsoft.com/msdn/default.aspx?ForumGroupID=2
Data Runtime:Data Runtime:http://msdn.Microsoft.com/Data/http://msdn.Microsoft.com/Data/
Patterns & Practices: Patterns & Practices: http://msdn.microsoft.com/library/default.asp?url=/librarhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/SCAG.aspy/en-us/dnpag/html/SCAG.asp
31
Community ResourcesCommunity Resources
At PDCAt PDCFor more information, go seeFor more information, go see
Wed 1pm & 3:15pm PRS402 Erik EllisWed 1pm & 3:15pm PRS402 Erik EllisHarnessing the Power and Flexibility of Windows Forms Harnessing the Power and Flexibility of Windows Forms 2.02.0Thur 11:30am PRS321 Mark BoulterThur 11:30am PRS321 Mark BoulterWindows Forms: Integrating Windows Forms and Windows Windows Forms: Integrating Windows Forms and Windows Presentation Foundation ("Avalon")Presentation Foundation ("Avalon")
Fri 10:30am PRS334 Chris Sells, Doug PurdyFri 10:30am PRS334 Chris Sells, Doug PurdyWindows Presentation Foundation ("Avalon") + Windows Windows Presentation Foundation ("Avalon") + Windows Communications Foundation ("Indigo") = MagicCommunications Foundation ("Indigo") = Magic
Fri 1pm FUN222 Jamie CoolFri 1pm FUN222 Jamie CoolWhat’s New in Software Installation for Windows Vista: What’s New in Software Installation for Windows Vista: Exploring the Windows Installer (MSI) and ClickOnce OptionsExploring the Windows Installer (MSI) and ClickOnce OptionsLabs: Labs:
FUNHOL15 ClickOnce Deployment FUNHOL15 ClickOnce Deployment PRSHOL17 New UI Features in Windows Forms PRSHOL17 New UI Features in Windows Forms PRSHOL18 New Data Features in Windows Forms PRSHOL18 New Data Features in Windows Forms PRSHOL19 Windows Forms: Advanced Layout PRSHOL19 Windows Forms: Advanced Layout
Ask The ExpertsAsk The Experts
© 2005 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.