如何识别客户端更改以进行双向同步? [英] how do client changes get recognized for bidirection sync?

查看:167
本文介绍了如何识别客户端更改以进行双向同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在客户端上保留我的存储库数据的子集。客户端计算机将添加和删除数据。我想告诉同步系统我只想同步一个特定的数据子集,但在细节上却非常迷失。



我使用vs 2008来创建本地数据缓存。我可以强制同步降低和双向同步。但是当我开始使用真实数据时,同步时间太长了。我想继续使用vs 2008代码生成器,但我无法看到如何在不修改设计器代码的情况下添加过滤条件,如果我删除并重新添加同步表,它将会更改。



所以我想我可以牺牲设计师。我将代码复制到一个文件中,我不会轻易地混淆设计器代码并删除设计器文件。同步仍然有效。但是当我去添加过滤器时,我意识到我不明白同步系统将如何区分过滤数据和已删除数据。或者在过滤后的数据和已更改的数据之间。



我查看了生成的代码并且不明白框架如何判断客户端上的数据是否已更改或是否存在。那同步真的在做什么?什么样的数据来自谁来决定一方或另一方需要改变?我找到了syncServicesADOv2_CSharp_adapterBuilder并用它来生成一些同步sql。似乎主键中的数据以某种方式由同步机制使用。那么有多少数据来回移动?服务器更改表如何识别从客户端删除记录?似乎生成的所有sql都是服务器端的。由于我主要是在改变客户端,所以我感兴趣的是同步框架如何找出发生了什么。



我也很困惑如何在没有服务器思考的情况下缩小客户端上的数据,我真的想从中删除数据。我的印象是同步会不断为客户带来新东西并留下当地的新东西。我的客户对超过特定天数的任何数据不感兴趣。我想删除该窗口中的数据,但不希望同步逻辑认为要从服务器删除此数据。



是否有一些我错过的文档,这些文档列出了这种一天的工作问题而不需要我成为同步开发专家?


< p align = left>


谢谢,


Jeff Landry


解决方案

在Server-client模型中,您只需要编程服务器端并为它们编写SQL查询。客户端已关闭,并自动为您完成。你不需要为它们生成任何命令。


我感兴趣的有几件事:



1。你提到同步时间太长了。您同步了多少数据?缓慢下降仅适用于第一次同步或所有后续同步吗?


2。我不明白你对过滤后的数据v / s删除数据的评论 - 过滤后的数据是客户端总是看到或永远不知道的东西。如果客户端看到它,则从服务器删除的数据将进入客户端(因为这些行满足过滤器,如果没有,则不会发送到客户端)


3 。如果您触摸了客户端上的任何数据,它将使用内置更改跟踪进行跟踪并发送到服务器。


4。您在服务器上编写的查询 - SelectIncrementalInsert,SelectIncrementalUpdate和SelectIncrementalDelete是管理从服务器到客户端需要哪些数据的查询。


5。在我阅读时,您需要一个用于数据的滑动窗口 - 要实现类似的功能,您可以尝试适当地制作SelectIncrementalInsert,SelectIncrementalUpdate和SelectIncrementalDelete命令。此外,您必须在SelectIncrementalDelete命令中伪造所有那些不再属于客户端的行的删除。



请参阅此示例以了解如何实现过滤: http://msdn.microsoft.com/en-us/library/bb726003.aspx 。它可能是一个良好的开端,即使它可能无法实现您的滑动窗口数据。



I wish to keep a subset of my repository data on a client.  The client machine will be adding and deleting data. I would like to tell the sync system that I only want to sync a specific subset of data, but am getting very lost in the details.

 

I used vs 2008 to create a local data cache.  I can force both sync down and bidirecitonal sync.  However when I start using real data the sync times in much too long.  I would like to continue to use the vs 2008 code generator, but i can't see how to add a filter criteria without modifying designer code which it appears would be changed if I removed and re-added the synced table.

 

So I thought I could sacrifice the designer.  I duplicated the code into a file I won't accidiently confuse with the designer code and deleted the designer files.  The sync still worked.  But when I went to add a filter I realized I don't understand how the sync system is going to distinguish between filtered data and deleted data.  Or between filtered data and changed data for that matter.

 

I looked through the generated code and don't understand how the framework can figure out if the data on the client has changed or just exists or not.  So what is the sync really doing?  What data is moving back and forth from who to who to decide if one side or the other needs to change?  I found syncServicesADOv2_CSharp_adapterBuilder and used it to generate some sync sql.  It appears that the data in the primary key is somehow used by the sync mechanism.  So how much data is moving back and forth?  How does the server change table recognize that a record was deleted from the client?  It appears that all the sql generated was for the server side.  Since I am primarily changing the client side I am interested in how slick the sync framework is about figuring out what happened there.

 

I am also confused about how I can shrink the data on the client without the server thinking I really, trully want the data deleted from it.  My impression is the sync will keep bringing new stuff to the client and leave the local new stuff around.  My client isn't interested in any data back more than a specific number of days.  I would like to delete the data out of that window but don't want the sync logic to think this data is to be deleted from the server.

 

Is there some set of documentation which I have missed which lays out this sort of work-a-day issues without requiring me to become a sync development expert?

 

Thanks,

Jeff Landry

 

解决方案

In the Server-client model, you only need to program the Server side and write SQL queries for them. The client side is closed and is automatically done for you. You do not need to generate any commands for them.

There are a few things I am interested in:

 

1. You mention that the sync time takes much too long. How much data do you have that you are synching? Is the slow down only for the first sync or all subsequent syncs too?

2. I did not understand your comment on filtered data v/s deleted data - filtered data is something that the client will either always see or never know about. Deleted data from Server will make it to the client if the client has seen it (because those rows satisy the filter, if not, they are not sent to the client)

3. If you have touched any data on the client, it will be tracked and sent up to the server using the in-built change tracking.

4. The queries that you wrote on the Server - SelectIncrementalInsert, SelectIncrementalUpdate and SelectIncrementalDelete are the queries that govern what data needs to go from Server to client.

5. As I read, you want a sliding window for the data - To achieve something like that, you can try to craft your SelectIncrementalInsert, SelectIncrementalUpdate and SelectIncrementalDelete commands appropriately. Additionally you will have to fake out deletes in the SelectIncrementalDelete command for all those rows that dont belong anymore at the client.

 

Refer to this example to see how you can achieve filtering: http://msdn.microsoft.com/en-us/library/bb726003.aspx. It can be a good start even though it may not achieve your sliding window data.

 


这篇关于如何识别客户端更改以进行双向同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆