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

Source: Internet
Author: User

In today's applications, some temporary offline applications require regular data synchronization with the primary database. Using the MS sync framework, you can quickly implement a solution, this framework is highly scalable and can be used for synchronization of databases (compatible with ado.net), files, and Web feeds.

Terms

[Specific translation in msdn]

Synchronization Scope

A synchronization scope is a logical grouping of objects that must be synchronized as a unit.

Knowledge

The metadata that is maintained by each participant ipant that describes all the changes it has seen. in its simplest form, known as a watermark, a knowledge item is a clock vector that consists of pairs of replica keys and replica tick counts.

Provision

After you define the synchronization scope, you provision the database to create a change-tracking and metadata management infrastructure that consists of metadata tables, triggers, and stored procedures.

References

Http://msdn.microsoft.com/sync

Http://msdn.microsoft.com/en-us/sync

Official blog http://blogs.msdn.com/ B /sync/

Http://social.msdn.microsoft.com/Forums/en-US/synclab/threads

How to: provision for synchronization using snapshot Initialization

Http://msdn.microsoft.com/en-us/library/gg294193 (V = SQL .110). aspx

Sync framework tips and troubleshooting

Http://social.technet.microsoft.com/wiki/contents/articles/sync-framework-tips-and-troubleshooting.aspx

Database Synchronization

  • Use snapshot initialization to create and initialize Multiple SQL Server compact databases in your synchronization community. snapshot initialization offers much faster performance for setting up multiple SQL Server compact databases than provisioning each one individually. and the API is simple, too! Here's an article that tell you how to do this: http://msdn.microsoft.com/en-us/library/gg294193 (V = SQL .110). aspx.
  • Use Backup and Restore (with post-Restore fixup) to create and initialize multiple large SQL Server databases in your synchronization community. if you are setting up a synchronization community that contains copies of a large SQL Server database, performance will be better if you use backup and restore to create the database copies instead of an initial synchronization. here's an article that tells you how to do this: http://msdn.microsoft.com/en-us/library/ee617375 (V = SQL .110 ). aspx.
  • Don't use truncate table to modify a table that is synchronized. this is because, while truncate table is in effect a delete statement, it does not activate the trigger used to update the change tracking metadata, so the deletion is invisible to sync framework and will not be sent to other replicas.
  • To find a list of the scopes that are currently provisioned in a database, queryScope_infoTable.Scope_infoTable contains information about each scope, including the scope name.
  • When a table in a SQL Server compact database is initialized through synchronization, the seed and increment of its identity columns are always set to 0 and 1, respectively, regardless of how they are set on the server database. if you need to insert rows locally in the client database you must first set the identity seed and increment to appropriate values or manually specify the identity column value, otherwise new rows will have duplicate identity values and row insertion will fail. the identity seed and increment can be set with the following query, which sets the seed value to 10 and the increment to 1:ALTER table exampletable alter column idcolidentity (10, 1)
Sync framework 4.0

This is the current version and is only the CTP version.

The following is a tool after installation.

C: \ Program Files (x86) \ microsoft sdks \ microsoft sync framework \ 4.0 \ bin

Syncsvcutilhelper.exe

Syncsvcutil.exe

It can be seen that common functions can be automatically generated using these tools to simplify the process.

The example directory iphonesample is a data service synchronization using the odata protocol.Program, Cool.

It is estimated that the official version will simplify development.

Example

Three synchronization Modes

Sync framework provides snapshot, download-only, upload-only, and bidirectional synchronization for client and server scenarios:

ØSnapshot and download-only SynchronizationAre typically used to store and update reference data, such as a product list, on a client. data changes that are made at the server are downloaded to the client database during synchronization. snapshot synchronization completely refreshes data every time that the client is synchronized. this is appropriate when you do not want to track incremental changes or the server cannot do so. download-only synchronization downloads only the incremental changes that have occurred since the previous synchronization.

ØUpload-only SynchronizationIs typically used to insert data, such as a sales order, on a client. inserts and other changes to data that are made in the client database are uploaded to the server during synchronization.

ØBidirectional SynchronizationIs typically used for data, such as customer contact information, that can be updated at the client and server. any conflicting changes must be handled during synchronization.

The SDK itself has examples. Other good reference resources

Additional samples are available in the sync framework SDK and on code Gallery.

Http://go.microsoft.com/fwlink? Linkid = 123328

This address contains examples of orcale and SQL Express.

Http://archive.msdn.microsoft.com/Release/ProjectReleases.aspx? Projectname = Sync & releaseid = 3422

Database sync-SQL Server and SQL compact 2-tier

Http://archive.msdn.microsoft.com/sync/Release/ProjectReleases.aspx? Releaseid = 3761

Database sync-Oracle and SQL compact 2-tier

Next I will analyze several examples of SDK testing to learn more about this framework.

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.