Answered by:
How to use MemoryConflictLog to log concurency conflicts with FullEnumerationSimpleSyncProvider

Question
-
Hi all,
I use a simple provider (FullEnumerationSimpleSyncProvider) that synchronize the data of outlook 2007 with a webservice.
I find a solution to log the concurency conflicts with MemoryConflictLog but i can't create ItemChange to use it for the MemoryConflictLog.SaveConflict method.
Can you tell me how accomplish this task.Monday, March 8, 2010 5:34 PM
Answers
-
Hi,
I find a solution:
For loggin conflict you must use SimpleProvider.DestinationCallbacks.ItemConflicting event and create an instance of MemoryConflictLog
and loggin the conflict when the conflict is detected and process the resolution after that sync session was ended.
The code look:
void DestinationCallbacks_ItemConflicting(object sender,ItemConflictingEventArgs e) { LogConflicts.SaveConflict(e.SourceChange, e.SourceChangeData, e.SourceChange.LearnedKnowledge); e.SetResolutionAction(ConflictResolutionAction.SaveConflict); }
and Then process the conflict resolution.
Look at this link for more information about how to resolve conflict manualy:
http://msdn.microsoft.com/en-us/library/dd918556%28SQL.105%29.aspx
Realtn.
- Marked as answer by realtn Wednesday, March 24, 2010 8:52 AM
Wednesday, March 24, 2010 8:01 AM
All replies
-
Hello realtn,
Why do you need to use this MemoryConflictLog? Using this with SimpleProvider is not a supported scenario as this might interfere with internal SimpleProvider logics.
Give us the use case and I will try to see if there is a better way to accomplish this.
Thanks,
PatrickTuesday, March 9, 2010 6:02 PM -
Hello Patrick,
I want to log conflicts to give users to choise the preferable conflicts resolution after the synchronisation was ended.
Thanks.Tuesday, March 9, 2010 6:13 PM -
Hello realtn,
Is the motivation to allow users to see what kind of conflict it is (i.e. update-update, update-delete, etc...)?
There is an event called ItemConflicting on SimpleSyncProvider which you can subscribe to.
Within that event arg, there is ConflictKind property which describes the conflict.
Also, if you would like to resolve concurrency conflicts in a customized way, there is an interface called ISimpleSyncProviderConcurrencyConflictResolver which
provider can implement.
Thanks,
PatrickTuesday, March 9, 2010 7:04 PM -
Hello Patrick,
I want generate a window that provide to user a choice between differents resolutions policy.
This window will be showed after the Call of SimpleProvider.endSession() method.
Thanks,
realtnWednesday, March 10, 2010 2:02 PM -
Hello Patrick,
Yes, it's the motivation to allow users to see what kind of conflict it is.
Thursday, March 11, 2010 3:52 PM -
Hi realtn,
Just to clarify, you mention that you will give users a choice to resolve after EndSession.
However, if you look at the sync session flow, EndSession is the last call after sync.
Its purpose is to give provider an opportunity to perform last remaining tasks after changes have been applied (e.g. clean up tasks, etc..).
In other words, conflict resolution should have been chosen after EndSession call. If you do not subscribe to ItemConflicting event, resolution will follow the
resolution policy set on the provider (which is to defer conflict).
Correct timing to give users a choice (i.e. conflict resolution action) would be within ItemConflicting event when the conflict is detected.
Within this event, the application has chance to look at conflicting items and reason, and surface the choice to the user, in which the user will choose an action.
Hope this helps,
Patrick- Marked as answer by Sid Singh [MSFT]Microsoft employee Monday, March 15, 2010 6:06 PM
- Unmarked as answer by realtn Tuesday, March 16, 2010 8:32 AM
Thursday, March 11, 2010 6:37 PM -
Hi,
I find a solution:
For loggin conflict you must use SimpleProvider.DestinationCallbacks.ItemConflicting event and create an instance of MemoryConflictLog
and loggin the conflict when the conflict is detected and process the resolution after that sync session was ended.
The code look:
void DestinationCallbacks_ItemConflicting(object sender,ItemConflictingEventArgs e) { LogConflicts.SaveConflict(e.SourceChange, e.SourceChangeData, e.SourceChange.LearnedKnowledge); e.SetResolutionAction(ConflictResolutionAction.SaveConflict); }
and Then process the conflict resolution.
Look at this link for more information about how to resolve conflict manualy:
http://msdn.microsoft.com/en-us/library/dd918556%28SQL.105%29.aspx
Realtn.
- Marked as answer by realtn Wednesday, March 24, 2010 8:52 AM
Wednesday, March 24, 2010 8:01 AM -
Patrick:
Can you elaborate on "Why do you need to use this MemoryConflictLog? Using this with SimpleProvider is not a supported scenario as this might interfere with internal SimpleProvider logics." realtn's solution won't work? Am I not supposed to use MemeoryConflictLog? My scenarios is to allow user to decide whether to resolve certain conflicts and/or use different means to resolve particular conflicts. Are there any alternatives to using logged conflicts?
Also, is there a sample to implement this? Thank you!
Thursday, April 1, 2010 1:36 AM -
realtn:
Would you provide some sample code of the actual "manual" resolution process? Thank you!
Thursday, April 1, 2010 1:36 AM -
Hi Friendly Dog II:
for more information visit this thread ( that i was created later):
Friday, April 2, 2010 2:31 PM