Sales Orders Sample Scenario

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This sample highlights how a merge replication topology can be implemented to deliver data to mobile users, and it also demonstrates the programmability features of merge replication. The sample is a Microsoft Windows Forms-based application that uses standard Microsoft data access technologies and merge replication to enable a salesperson to maintain her own local data while synchronizing periodically with the home office.

Adventure Works Cycles is a bicycle manufacturer that sells bicycles to retail bicycle shops throughout the United States and Canada. Adventure Works Cycles bicycles are sold direct to customers from their Web site and are purchased by the retail shops and resold at a markup; retail accounts are serviced by a nationwide sales force of Adventure Works Cycles sales professionals. This sales force is organized into sales territories, which are managed by Territory Sales Managers, who in turn report to the Vice President of Sales. Although all sales account data is maintained by the Adventure Works Cycles corporate office in Bothell, Washington, in a SQL Server database, individual salespersons are responsible for maintaining the sales-related data for their own accounts, including customer information and all sales and returns. Salespeople also must have access to the latest product-related data, including pricing, up-to-date inventory information, and individual historical sales data.

To best achieve its business goals, which includes providing the highest margins to its retailers, Adventure Works Cycles must minimize its operating costs while providing the most flexibility to its sales staff. To that end, Adventure Works Cycles has implemented a replication-based solution to managing its sales-related data. Each salesperson has been provided with a laptop or personal digital assistant (PDA), from which the salesperson uses a client application to enter sales data and view and modify customer and product information. Each laptop or device has a local copy of Adventure Works Cycles sales data provided by a merge replication subscription, which is partitioned based on their Windows login. At the end of the day, or whenever they can connect to the Internet, salespersons synchronize their local data by uploading local changes and downloading changes and updates to products from the company's AdventureWorks database information.

This sample demonstrates the following features of merge replication:

Merge replication feature Description

Replication Management Objects (RMO) API

RMO is used to create the initial subscription and to synchronize and monitor the subscription. For more information, see Replication Management Objects Concepts.

Parameterized row filters

Each subscription is filtered horizontally using parameterized row filters, which enables each salesperson to only get the data related to that salesperson's sales territory. For more information, see Parameterized Row Filters.

Precomputed partitions

When data changes result in a row leaving a given partition, this work is done at the Publisher before the synchronization starts, which can result in significant performance improvements during synchronization. For more information, see Optimizing Parameterized Filter Performance with Precomputed Partitions.

Client-requested partitioned snapshot

Rather than having to manually create the partitioned snapshot for each subscriber, the partitioned snapshot is created when the subscriber requests it. For more information, see Snapshots for Merge Publications with Parameterized Filters.

Business logic handler framework

This sample implements a business logic handler to invoke custom logic during synchronization. For more information, see Executing Business Logic During Merge Synchronization.

Article type-based performance optimizations

The subscription for this sample uses articles that are specified as either download-only or as belonging to nonoverlapping partitions, which enables performance optimizations for the synchronization process. For more information, see Parameterized Row Filters and Optimizing Merge Replication Performance with Download-Only Articles.

SQL Server Compact 3.5 SP1 Subscribers

The publication for this sample supports SQL Server Compact 3.5 SP1 Subscribers. For more information about programming replication for SQL Server Compact 3.5 SP1 Subscribers, see SQL Server Compact Replication Programming.

Automatic identity range management

Replication does the hard work of managing the ranges assigned to identity columns when rows are inserted at the Subscriber and Publisher. For more information, see Replicating Identity Columns.

Web synchronization (optional)

You can optionally configure the Publisher so that subscriptions can be synchronized securely over the Internet using secure socket layer (SSL) technology, which enables a salesperson to synchronize data without having to establish a virtual private network (VPN) connection to the Publisher. For more information, see Web Synchronization for Merge Replication.

Monitoring Replication

Replication provides system stored procedures on the Subscriber that return information on previous synchronization sessions.