Udostępnij za pośrednictwem


Sales Orders Sample Scenario

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 in SQL Server 2005. 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.

Sample Scenario

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 2005 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.

Replication Features Highlighted

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 Programming with Replication Management Objects.

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 Edition (SQL Server 2005 Compact Edition) Subscribers

The publication for this sample supports SQL Server 2005 Compact Edition Subscribers. For more information about programming replication for SQL Server 2005 Compact Edition Subscribers, see SQL Server Compact Edition 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.

See Also

Concepts

Sales Orders Sample Implementation Details

Other Resources

Sales Orders Sample for Merge Replication

Help and Information

Getting SQL Server 2005 Assistance