* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download SQL / CE - Piper Jaffray
Survey
Document related concepts
Transcript
Developing Mobile Applications Tim Heuer Immedient [email protected] Bert Solano Immedient [email protected] Agenda Mobile Overview VS .NET Features Data Storage Options Tips and Tricks CE Devices are available Mobile vs. Wireless Mobile Architectures Application can function in a vacuum “Synchronize When You Can” Wireless Tethered to the data source, just like wired, only we use wireless WiFi, CDPD, GPRS, Prone to problems Mobile Apps leverage Wireless Wireless is NOT Mobile Goal for a Mobile App Can your user function from the bottom of the ocean? (… with a waterproof device) Is your application as reliable as their paper notebook? Take advantage of the internet, don’t depend on it. Compatibility Challenges Many different device types Different form-factors Human interface choices Connectivity choices WiFi Network Cradle Compact Flash WWan Desktop Cradle Infra Red On-device resources vary widely ROM/RAM capacity File system Battery life Mobile Development Environment Single set of familiar productive tools for all development Server components Rich client applications Mobile Web development Building Web services Consuming Web services Easily take advantage of all Microsoft mobile platform assets Mobile Development Approaches Client Application Web Application Application on device Device specific Fewer devices Application on server Runs in browser Many devices Offline options Richest UI Online only Less UI choice Easy to deploy Mobile Development Tools Today Client Application Web Application Embedded Visual Tools eVB and eVC++ Device-specific Active Server Pages Visual Studio & .NET Compact Framework Visual Studio & Mobile Internet Toolkit Mobile Internet Toolkit Components Mobile controls Mobile designer Rich device identification Rapidly develop Mobile Web Applications Powerful and flexible Easy to customize and extend For future devices Mobile Controls Render based on device capabilities Automatically output multiple markup languages Built upon ASP.NET control base classes Common controls: Label TextView Link Calendar .NET Compact Framework Smart Device Extensions A subset of the .NET Framework Lightweight and Resource Efficient Same programming model Same security as desktop programming model RAM Battery and CPU usage Flash and ROM Rich PocketPC Functionality Windows Forms (WinForms) ADO.NET Data Access XML Web Services Client With Windows CE Windows CE Device XML Web Services Windows Forms Windows UI Data and XML XML Web Services Base Class Library Take advantage of Windows richness Windows NT® network integration Data Access Common Language Runtime Standard Windows look and feel Forms-based UI All the standard controls Significant subset for small size Local data (offline) Remote data (online) Simple structured files (text) Device Compatibility .Net Compact Framework Faithful implementation of Standard CLI Core types and methods + device extensions Microsoft Full .NETto Framework Subset of .Net framework appropriate Desktop smart device development Microsoft .NET Compact Framework Pocket PC (CE) Microsoft .NET Compact Framework Smart Phone ISO/IEC 23271:2002 / ECMA 335 Microsoft Windows CE Extensions IRDA, Barcode Scanner, etc Common Language Infrastructure It’s All About Balance (Developer Perspective) This is NOT the desktop, think 100mhz Features Amount of Data Garbage Collection Data Entry/Selection Performance Memory Usage Data, Objects Connectivity Device Databases Microsoft Strategy Scalable Solutions Scalable Solutions SQL Server MSDE SQL Server CE } Server, Desktop, Tablet PC CE Platform SQL Server CE Database for the CE / Pocket PC Platform Similar programming style to SQL Server Limitations are more device then SQL/CE 1 Connection/ Database, (usually not a problem) Multiple Databases per device No Stored procs Use cached DataCommands Referential Integrity with cascading updates/Deletes Stand alone, or replicate/sync with SQL Server (SQL CE) SQL Server not required, but best match SQL Server CE 2.0 designed for .NET Compact Framework (System.Data.SqlServerCe) Replacement of Pocket Access, just like DBF/Access CE Data Access Storage Architecture .NET CF / Managed Stack Native/Unmanaged Stack eVB 3.0 ADO CE v3.1 VS .NET (VB.NET, C#) ADO.NET eVC 3.0 SQL Server CE Data Provider SQL Server Client Data Provider CLR / .NET CF Ethernet TDS Well Connected OLEDB CE SQL CE Edition v2.0 Data Provider OLEDB QP/Cursor Engine/ES OLEDB Client Agent: Replication and RDA Storage Engine / Repl Tracking 802.11b, CDPD, GSM, CDMA, TDMA, etc. IIS HTTP Occasionally Connected CLIENT SERVER OLEDB / Replication API Server Agent: Replication and Remote Data Access Setting up SQL CE Replication Basic Replication setup + Install SQL CE Replication Tools http://www.microsoft.com/sql/downloads/ce/sp3.asp Test connectivity from device Localhost won’t work NETBIOS name may not work (WINS Resolution) Test with IP or Fully Qualified Domain Name If you don’t get this response from the DLL, don’t go any further http://192.168.1.100/Repll/sscesa20.dll SQL / CE – Data Transfer Multiple Techniques RDA system.Data.SqlServerCe.SqlCeRemoteDataAccess Merge Replication Over IIS System.Data.SqlServerCe.SqlCeReplication Great for managing concurrency ADO.net System.Data.SqlClient.SqlCommand Great for semi-connected environments, large data transfers Can call SQL Server directly, but not a great idea…* (*Not a Mobile Architecture) Web Services Great when concurrency isn’t an issue, or server isn’t SQL Supported ADO .NET And XML Classes On .NET CF XmlDocument DataView XmlReader DataSet XmlWriter XML File SqlDataReader SqlCeDataReader SqlDataAdapter SqlCeDataAdapter SqlCommand SqlCeCommand SqlConnection SqlCeConnection .NET Data Provider .NET Data Provider for SQL CE for SQL Server Parsing Exceptions public static void ShowErrors(SqlCeException se) { SqlCeErrorCollection errorCollection = se.Errors; StringBuilder exInfo= new StringBuilder(); Exception inner = se.InnerException; foreach (SqlCeError err in errorCollection) { exceptionDetailStringBuilder.Append("\n Error Code: " + err.HResult.ToString("X")); exceptionDetailStringBuilder.Append("\n Message : " + err.Message); exceptionDetailStringBuilder.Append("\n Minor Err.: " + err.NativeError); exceptionDetailStringBuilder.Append("\n Source : " + err.Source); foreach (int numPar in err.NumericErrorParameters) { if (0 != numPar) exceptionDetailStringBuilder.Append("\n Num. Par. : " + numPar); } foreach (string errPar in err.ErrorParameters) { if (String.Empty != errPar) exceptionDetailStringBuilder.Append("\n Err. Par. : " + errPar); } MessageBox.Show(exceptionDetailStringBuilder.ToString()); exceptionDetailStringBuilder.Remove(0, exceptionDetailStringBuilder.Length); } } Mobile Application Tips and Tricks Always think Performance, …always Test performance on everything Get the actual device Design and Proof of Concept EVERYTHING Get a wireless Lan for debugging Reuse everything you can Database optimization is KEY Don’t assume flat is good. Balance of normalization is good Don’t assume your .sdf needs to have the same structure as the server Tips and Tricks This is NOT a 1.8GHZ Processor Be kind to your environment protected override void OnClosing(CancelEventArgs e) { this.Save(); e.Cancel = true; this.Hide(); base.OnClosing (e); } Use DataSets to cache data …more to come… Save Forms that will be used again Reuse Everything Pre-Load Data Think 100MHZ Use a forms collection that caches forms Toss objects that you don’t use often Don’t try to load 9 MB of data onto a device with 8 MB of RAM Resources Newsgroups: microsoft.public.dotnet.framework.compactframework http://www.gotdotnet.com/team/netcf SQL CE http://www.microsoft.com/sql/ce/ http://www.microsoft.com/sql/ce/techinfo/defa ult.asp Article on Setting up a sample Replication and RDA http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dnsqlce/html/sqlwince.asp Q&A