Data synchronization framework Ms sync framework-ide quick development supports local database cache

Source: Internet
Author: User

Data synchronization framework Ms sync framework [terms, examples, references, tips]

Http://www.cnblogs.com/2018/archive/2011/02/22/1961654.html

Data synchronization framework Ms sync framework-Use Cases and brief analysis in different scenarios

Http://www.cnblogs.com/2018/archive/2011/02/23/1961657.html

The above two articlesArticleThe framework is described. The local database cache provided by IDE can quickly implement a common synchronization application. The details are as follows:

The MS sync framework is provided by vs for offline client use. The client is SQL compact, and the server can be SQL Server 2005/2008.

 

For more information, see:

Http://cid-56b433ad3d1871e3.office.live.com/self.aspx/.Public/SyncTest.rar

The dbcache directory is a specific example. The creation steps are as follows:

Template

After adding the file *. Sync, double-click the file to edit and modify it.

Synchronization settings

Double-click northwind. server. Sync or northwind. server. sync to modify

In SQL Server 2008, you can use SQL Server change tracking.

Sqlscripts sqlundoscripts: support and cancellation of database provison

Northwinddataset. XSD: cache access interface of the Client

Synchronization Code
Using (dataserviceproxy. northwindsynccontractclient datasvc = new dataserviceproxy. northwindsynccontractclient ())
{// Nwcache. SDF synchronize the data during default table Creation
Northwinddatasettableadapters. mermerstableadapter customerstableadapter
= New northwinddatasettableadapters. customerstableadapter ();
Northwinddataset = new northwinddataset ();
Customerstableadapter. Fill (northwinddataset. MERs mers );

New northwinddatasettableadapters. productstableadapter (). Fill (northwinddataset. products );
/// Modify (add, delete, modify) the SQL server's MERs table
Northwindsyncagent syncagent = new northwindsyncagent (datasvc );
Microsoft. synchronization. Data. syncstatistics syncstats = syncagent. Synchronize ();
Debug. writeline (syncstats. totalchangesdownloaded );

/// At this time, the client data has been synchronized
Customerstableadapter. Fill (northwinddataset. MERs mers );
New northwinddatasettableadapters. customerstableadapter (). Fill (northwinddataset. MERs mers );
New northwinddatasettableadapters. productstableadapter (). Fill (northwinddataset. products );
}
Summary

As shown above, you can quickly create a common sync using IDE.ProgramThe default program can only be downloaded. If you need two-way synchronization, refer to the SDK:

Walkthrough: extending the local database cache to support bidirectional Synchronization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.