Download presentation
Presentation is loading. Please wait.
1
Occasionally Connected Smart Clients Steve Lasker Program Manager Visual Studio Microsoft Corporation Steve.Lasker@Microsoft.comblogs.msdn.com/SmartClientData
2
2 What Is: Occasionally Connected Empowering users to leverage their computer, applications, data and files regardless of network availability Application proactively retrieves necessary data necessary to work offline As the network comes available, the application will automatically sync their work and log conflicts for the user to resolve Network operations occur in the background so the user can stay focused on their task Example: Outlook 2003
3
3 Agenda Resources for working offline Occasionally Connected Systems Common Architecture Demo Scenario Demo Architecture Database Options Sync Options Application Updates Running Background Tasks Asynchronously
4
4 Resources Needed Offline Data A subset of the data from the server(s) Heterogeneous Sync (SQL Server, Oracle, DB2, …) Files Not all data exists within the database Media files, Office Files, … Application Messaging (Web Services, WCF, …) Ability to queue outbound messages Ability to async process inbound messages Read Only Informational/Reference Data Services Ability to pre-fetch data from existing services
5
5 Occasionally Connected Smart Client Background Tasks Network Resources Data Sync Services Data Access API Data Store Message Queuing Message Caching Files File Sync Services Microsoft Windows / Windows Mobile Visual Studio Smart Client Application / UI Application Updates Canned UI Controls
6
6 Adventure Works Sales Field Sales Multi-level marketing Consumers sell Adventure Works Products Need for the app to run disconnected Sellers are independent Hardware not owned by Adventure Works Many platforms BrowserDesktop Tablet PC Pocket PC Smart Phone
7
7 Adventure Works Sales Smart Client Background Tasks Adventure Works Corp Adventure Works Sales Architecture Network Services SyncServices Data Store WeatherCaching Order Submission Queue Promo Videos App Logic DesktopTabletPCPocketPC Smart Phone DataServer Sync Service s Order WeatherServices Product Catalog My Customers Order Scratchpad My Inventory App Updates
8
8 Which Local Data Store? Microsoft Database Technologies SQL Server 2005 SQL Server Express Edition SQL Server Mobile Edition Jet (Access) Microsoft Visual FoxPro (.dbf) Excel XML WinFS Something new
9
9 SQL Server Express Great improvements over MSDE Simple install from web or local MSI ClickOnce will BootStrap SSE if not installed Connect w/File Path Connection String User Instance feature for File Path Connecitons Great for VS Development
10
10 Deploying SSE For Occasionally Connected Scenarios Base Install of SSE ClickOnce Bootstrapper Requires Admin Rights Replication w/SSE Replication not supported w/User Instances Enable SQL Server Authentication Add DBO Privileged Account Script creation of database Verify / Create / Attach database at startup Deploy SQL Server Replication.Dlls
11
11 Occasionally Connected Devices ServersDesktopsLaptops Tablet PC’s Windows CE Pocket PC Smart Phone ? Win 32 Sweetspot
12
12 Local Database Options Server Workgroup Desktop Laptop Tablet PC Windows CE Device Pocket PC Smart Phone Win 32 SQL Server Express SQL Server Multi User Single User Scenarios SQL Mobile
13
13 Deploying SQL Server Mobile SQL Server Mobile Engine Add runtime dlls to project (sqlce*.dll) C:\Program Files\Microsoft Visual Studio 8\Common7\IDE File size <1.4mb Set files to Copy to Output Directory = Copy if newer ADO for SQL Server Mobile Add reference to Microsoft SQL Mobile Located in: C:\Program Files\Microsoft Visual Studio 8\ _ Common7\IDE\PublicAssemblies\System.Data.SqlServerCE.dl l File Size ~224k
14
14 Deploying SQL Server Mobile
15
15 SQL Server Mobile Runtime.dll file Functionality sqlcese30.dll SQL Server Mobile Engine. sqlceqp30.dll SQL Server Mobile Query Processor. Required for all SQL Server Mobile applications. sqlceme30.dll Required for ADO.net, System.Data.SqlServerCe.dll sqlceer30[language].dll Contains error strings for SQL Server Mobile-generated errors. Required for all SQL Server Mobile applications. sqlceca30.dll The SQL Server Mobile Client Agent. Required for applications that connect to SQL Server by using replication or remote data access. sqlcecompact30.dll Provides the compact database functionality. sqlceoledb30.dll Provides OLE DB connectivity to SQL Server Mobile databases. Required only if your application uses OLE DB to connect to the SQL Server Mobile database. Used by RDA. Total File Size 1.34mb
16
16 How - To Sync Roll your own Ultimate in flexibility Highest cost to develop and maintain Merge Replication Most power, broadest features for different data partitions, spans all devices Need DBO/DBA privileges, must “own” server Remote Data Access (RDA) Easy entry point for well partitioned data, no config to database Limited to SQL Server Mobile Technology Roll your own MergeReplicationRemote Data Access XML - DataSets SQL Server Express SQL Server Mobile
17
17 Local App RDA Sync Architecture Server Data SQL Server Mobile Database Engine DAL UI InOut IIS w / Sync ISAPI dll RDA Sync Engine
18
Smart Client WCF Cache Sales Fulfillment Accounting Inventory Logic Sync Transport Logic Rules Logic Rules Logic Rules Local Data Store Rules WCF Queue Controls Validation Logic* Logic Sync Client 18 RDA.Pull(“Products", _ "SELECT ProductId, Name, Description, Category, UnitPrice " & _ "FROM Products", _ My.Settings.ServerOleDBConnectionString, _ RdaTrackOption.TrackingOff) ReferenceDataProductCatalog RDA: Initializing Reference Data
19
Smart Client WCF Cache Sales Fulfillment Accounting Inventory Logic Sync Transport Logic Rules Logic Rules Logic Rules Local Data Store Rules WCF Queue Controls Validation Logic* Logic Sync Client 19 Rda.Pull(“Customers", _ "SELECT CustomerId, Name, Address, Phone, Fax" & _ "FROM Customers", _ My.Settings.ServerOleDbConnectionString, _ RdaTrackOption.TrackingOn) UpdateableDataCustomers RDA: Initializing Updatable Data
20
Smart Client WCF Cache Sales Fulfillment Accounting Inventory Logic Sync Transport Logic Rules Logic Rules Logic Rules Local Data Store Rules WCF Queue Controls Validation Logic* Logic Sync Client 20 Rda.Push(“Customers", _ My.Settings.ServerOleDbConnectionString, _ SyncBatching.BatchingOn) UpdateableDataCustomers RDA: Pushing Changes Back In
21
21 Smart Client WCF Cache Sales Fulfillment Accounting Inventory Logic Transport Logic Rules Logic Rules Logic Rules Incorporating WCF w/RDA Local Data Store Rules Controls Validation Logic* Logic Sync Client WCF Queue
22
22 Remote Data Access (RDA)
23
23 Configuring RDA Configure Web Sync Point Write client side code Dim 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
24 RDA Limitations Based on Snapshot Push, Push, Push Changes at server aren’t pulled down until next snapshot Limits the Product Catalog scenarios Updates are limited to last client wins Comparison based on PK only
25
25 App Updates With ClickOnce ClickOnce 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 Return updateInfo End If End Function
26
26 App Updates - ClickOnce
27
27 BackgroundTasks / Steps Runs on a background thread of the application Executes collection of steps Start / Stop similar to Windows Services Executes in a loop based on a Timer Can be triggered by Network Resources Marshals progress / completed info to UI thread
28
28 Background Tasks
29
29 Summary Smart Client Advantages Ability to work offline Ability to work on behalf of the user Leverage, embrace reference data Leverage Microsoft local data stores SQL Server Express Edition SQL Server Mobile Edition Build sync APIs as background tasks Composable Sync APIs are coming… Leverage Occasionally Connected Systems Architectures to be well positioned Leverage ClickOnce APIs for updates
30
30 Resources Data Designers & Occasionally Connected Systems Discussions: http://blogs.msdn.com/SmartClientData Drag Once Databinding: http://www.Code-Magazine.com/Article.aspx?quickid=0409051 Drag Once w/Custom Controls: http://www.Code-Magazine.com/Article.aspx?quickid=0411071 Windows Forms: http://www.WindowsForms.net http://msdn.Microsoft.com/WindowsForms/ http://forums.Microsoft.com/msdn/default.aspx?ForumGroupID=2 http://www.WindowsForms.net Data Runtime: http://msdn.Microsoft.com/Data/ Patterns & Practices: http://msdn.microsoft.com/library/default.asp?url=/library/en- us/dnpag/html/SCAG.asp
31
31 Community Resources At PDC For more information, go see Wed 1pm & 3:15pm PRS402 Erik Ellis Harnessing the Power and Flexibility of Windows Forms 2.0 Thur 11:30am PRS321 Mark Boulter Windows Forms: Integrating Windows Forms and Windows Presentation Foundation ("Avalon") Fri 10:30am PRS334 Chris Sells, Doug Purdy Windows Presentation Foundation ("Avalon") + Windows Communications Foundation ("Indigo") = Magic Fri 1pm FUN222 Jamie Cool What’s New in Software Installation for Windows Vista: Exploring the Windows Installer (MSI) and ClickOnce Options Labs: FUNHOL15 ClickOnce Deployment PRSHOL17 New UI Features in Windows Forms PRSHOL18 New Data Features in Windows Forms PRSHOL19 Windows Forms: Advanced Layout Ask The Experts
32
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.