8 สิงหาคม 2551 21:20
I'm trying to use the FileSyncProvider as a source, and my own provider as a destination. Is this a supported scenario? Or is the assumption that both providers have to be the of the same kind?
The specific issue I'm running into is that I can not seem to get a IChangeDataRetriever from the FileSyncProvider, is this by design?
- ย้ายโดย Max Wang_Chinasoft 20 เมษายน 2554 21:46 Forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
8 สิงหาคม 2551 21:45ผู้ตอบ
That's a supported scenario, however there is a limitation currently.
If you are using C++ code, you could implment IFileDataRetriever then you will be able to write your own provider to sync with FileSyncProvider.
But That's not supported in managed framework yet.
8 สิงหาคม 2551 21:59Thanks! When do you think this will be supported in manage code?
8 สิงหาคม 2551 22:18ผู้ตอบ
I believe it will be considered in v2 or earlier CTPs.
7 กันยายน 2552 10:36Bassam, have you ever got any solution to this?
Jin, Is this taken care in MSF V2 CTP2? can you point me to some article?
9 ธันวาคม 2552 0:30Synchronizing the file synchronization provider with a custom provider using managed code is supported in Sync Framework 2.0. This article in the product documentation explains how to do this: http://msdn.microsoft.com/en-us/library/ee617372(SQL.105).aspx.
This sample on Code Gallery may also help: http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3592.
11 ธันวาคม 2552 5:52Has this been included in V2? If I implement IChangeDataRetriever in an overriden FileSyncProvider class, nothing happens. Am I implementing the interface in the wrong place?
11 ธันวาคม 2552 18:53
This is included in Sync Framework 2.0. You shouldn't need to override the FileSyncProvider class to implement this. Here's what you need to do:
- Implement IFileDataRetriever in your custom provider. This implementation returns your item data in a format that the file synchronization provider can use.
- When your custom provider is the source provider, its LoadChangeData method is called to retrieve item data. Return your IFileDataRetriever object. The destination provider (FileSyncProvider in this case) retrieves data by calling the methods on your IFileDataRetriever object.
- When your custom provider is the destination provider, its SaveItemChange method is called to apply a change. The SaveChangeContext.ChangeData object that is passed to this method is an IFileDataRetriever implementation. Cast the object to the IFildDataRetriever interface and retrieve the file data to apply.
This is all explained in greater detail in the document referenced above.