Occasionally Connected Occasionally Connected Smart Clients Smart Clients Steve Lasker Steve Lasker Program Manager Program Manager Visual Studio Visual Studio Microsoft Corporation Microsoft Corporation [email protected][email protected]blogs.msdn.com/SmartClientData blogs.msdn.com/SmartClientData
32
Embed
Occasionally Connected Smart Clients Steve Lasker Program Manager Visual Studio Microsoft Corporation [email protected]/SmartClientData.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
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
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
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
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
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/
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