Book Image

.NET Compact Framework 3.5 Data Driven Applications

By : Edmund Tan
Book Image

.NET Compact Framework 3.5 Data Driven Applications

By: Edmund Tan

Overview of this book

<p>The new .NET CF 3.5 framework provides enterprise application developers with a whole arsenal of possibilities at their disposal, but without proper guidance on developing performance-critical enterprise applications, it is easy to make the wrong design and technology decisions.<br /><br />This book guides you to build each part of a robust enterprise application by illustrating the .NET CF 3.5 framework with the help of real-world business applications. It will not only help you to master basic .NET CF skills, but also outlines the best methods, techniques, and tools available to create high-impact and performance-critical data-driven enterprise mobile applications. It provides a solid set of guidelines to aid .NET CF developers to understand how best to apply the features of the .NET CF 3.5 framework.<br /><br />The bulk of the book illustrates the basic concepts of .NET Compact 3.5 Framework programming by walking the reader through 3 different kinds of mobile applications:</p> <ul> <li>A thick-client mobile sales-force application</li> <li>A thin-client mobile dashboard and reporting application</li> <li>A customer support case management application</li> </ul> <p><br />Both the SQL Server Lite and Oracle Lite mobile databases are covered in detail, from data access to data synchronization. The book explains how device features such as Bluetooth, SMS, telephony, Infrared, and Windows Contacts can be accessed via .NET CF in a real-world example, namely the mobile sales-force application. It also explains.NET CF's GDI+ features that can be used to create rich charts and reports. You learn to synchronize the mobile application with remote datasources and communicate via web services and WCF services. The book outlines performance optimization and memory management techniques on the mobile platform. It also outlines the tools and techniques available for testing, performance-tuning, deploying and debugging .NET CF enterprise applications (including Power Toys for .NET Compact Framework 3.5 from Microsoft).</p>
Table of Contents (18 chapters)
.NET Compact Framework 3.5 Data-Driven Applications
Credits
About the Author
About the Reviewer
Preface

Preface

As business systems become increasingly distributed, the mobile device becomes an increasingly important tool on the enterprise stage. The large amount of processing power available to mobile devices nowadays bring to it a whole new range of possibilities as a mobile extension to traditional server-based enterprise systems.

Harnessing this power is the .NET Compact Framework, which has seen tremendous improvements over the last few versions. The .NET Compact Framework provides a rich set of managed classes that does away with a big chunk of the menial labor required to perform common tasks, leaving the developer to focus on building business logic instead.

This book is not intended to be a complete reference tome of the .NET Compact Framework. There are numerous books and documentation online that serve this purpose. Rather, it will show you how to apply the .NET Compact Framework in interesting ways to solve real-world business problems. We will explore commonly encountered design decisions and technology comparisons along the way and ultimately build clean solutions that keep to best practices such as the three-tier design and the Model View Controller (MVC) model.

Using a sales force application as the central example and theme in this book, you will have a clear step-by-step guide on building one of the most popular types of business applications in the market today from ground up. Through these pages, you will learn how to create robust data-driven mobile applications that work seamlessly with other mobile devices and database servers. You will get to explore the little nuances of .NET Compact Framework programming, and how to get around them using its advanced features. You will also get a firsthand look at how you can use third-party libraries such as the open source Smart Device Framework to add a host of rich functionality to your applications.

Towards the end of this book, you will have accumulated enough understanding of the capabilities and limitations of the .NET Compact Framework and its tools to confidently tackle an enterprise mobile application of any size or complexity.

I hope in the process of getting there you will have as much fun reading this book and trying out the samples as I had writing it.

What this book covers

Chapter 1, CRMLive.NET: An Overview, provides a technical and scope overview of CRMLive.NET, a mobile customer relationship management suite comprising three individual applications (a mobile sales force, mobile dashboard, and mobile support case application).Chapter 1 also outlines the four different mobile client models and a comparison of their strengths and weaknesses.

Chapter 2, Building the Data Tier, shows how a plugin-based data tier based on both the Microsoft SQL Server Compact and Oracle Lite databases can be created using ADO.NET.

Chapter 3, Building the Mobile Sales Force Module, walks the reader through building the logic and presentation tiers of the mobile sales force application, illustrating various concepts along the way such as UI object reusability, validation, paging, record navigation, sorting, and grouping.

Chapter 4, Building Search Functionality, illustrates how full-text search and parameterized-search functionality can be added to the mobile sales force application.

Chapter 5, Building Integrated Services, illustrates how the sales force application can make use of the .NET Compact Framework and P/Invoke calls to access underlying Windows Mobile operating system and mobile device functionality such as the Bluetooth, Infrared, Calendar, and Telephony services.

Chapter 6, Data Synchronization, covers one of the most important topics in the book—the process of data synchronization between the mobile device and the remote database. In this chapter, we will look at how the sales force application can perform bidirectional synchronization using Microsoft SQL Server Compact's SQL RDA and Oracle Lite's mSync technologies.

Chapter 7, Optimizing for Performance, illustrates how the sales force application's performance can be measured and improved using various techniques such as data caching and data compression.

Chapter 8, Securing the Application, covers the various ways to secure locally stored data on the mobile device. It also covers the various authentication mechanisms available during data synchronization with the remote database.

Chapter 9, Globalization, illustrates how the reader can globalize the sales force application to intrinsically support double-byte (Unicode) languages.

Chapter 10, Building the Dashboard, walks the reader through the building of the second application in CRMLive.NET—the mobile dashboard. It will cover the use of stateless asynchronous web service calls to retrieve XML-based data from a remote server.

Chapter 11, Building the Support Case System, walks the reader through the building of the third application in CRMLive.NET—the mobile support case application. It will cover how a messaging backbone based on Microsoft Messaging Queue (MSMQ) technology can be built to support disconnected-state messaging between two remote applications.

Chapter 12, Testing and Debugging, looks at how the tools provided in the PowerToys for .NET CF 3.5 suite can assist in the testing and debugging process of the CRMLive.NET application.

Chapter 13, Packaging and Deployment, walks through the packaging and deployment process of the CRMLive.NET application and how a network-aware, automated update service can be created to assist in the deployment of application upgrades.

What you need for this book

This book provides all source code in both VB.NET and C#. To run most of the code samples in this book, you will need the following basic tools:

  • A suitable development workstation with Microsoft Visual Studio 2008

  • Windows Mobile 6 SDK (includes an emulator for you to test your .NET CF applications)

  • Microsoft ActiveSync 4.5 (for Windows XP machines) or Microsoft Mobile Device Center (for Windows Vista machines)

  • The .NET Compact Framework 3.5 redistributable

  • The Microsoft SQL Server Compact 3.5 database

Throughout the book, we will also encounter certain technologies and products when we build our application. The following lists the other products used in the book:

  • InChapter 2, we will show how the data tier can also be built to support the Oracle Lite database. To run the Oracle Lite code samples, you will need to download and install Oracle Lite 10g.

  • In Chapters 5 and 10, we make use of the Smart Device Framework to handle specific requirements in the CRMLive.NET application. To run the code samples in these chapters, you will need to install the Community Edition of the Smart Device Framework v. 2.3.0.39 (at the time of writing).

  • InChapter 11, we will be building a messaging backbone on top of the Microsoft Messaging Queue service. You will need to install the MSMQ service on the mobile device.

  • InChapter 12, we will cover the tools provided in the PowerToys for .NET CF 3.5 suite (provided by Microsoft) to test and debug the CRMLive.NET application. You will need to install this product to try out the samples in this chapter.

Who this book is for

This book is primarily targeted at developers who are new to the .NET Compact Framework and wish to embark on data-driven mobile application development in an enterprise scenario. All code samples included in this book are in VB.NET and C#.

This book assumes you are familiar with either the Visual Basic.NET or C# language. It does not require you to have any prerequisite experience or knowledge of the .NET Compact Framework.

This book is also targeted at:

  • Developers who are already familiar with the .NET Compact Framework, but want to learn about how it can be effectively used to tackle commonly faced problems in real-life business scenarios

  • Developers who want to learn how to use the .NET Compact Framework to access core Windows Mobile 6.0 and device functionality

Most of the samples in this book are targeted at the Windows Mobile operating system. Some basic knowledge of the Windows Mobile operating system would be beneficial, but not necessary.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can include other contexts through the use of the include directive."

A block of code will be set as follows:

public string PluginDatasource {
get { return _PluginDatasource; }
set { _PluginDatasource = value; }
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be shown in bold:

public bool SetAccountDetails(Guid AccountGUID, System.Data.DataSet Account)
{
SqlCeDataAdapter _adapter;
SqlCeTransaction _transaction;

}

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: " Open Windows Mobile Device Center and click on Connection Settings under Mobile Device Settings. "

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an e-mail to , and mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Note

Downloading the example code for the book

Visit https://www.packtpub.com//sites/default/files/downloads/0102_Code.zip to directly download the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration, and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.