locked
Syncing on seperate thread process... RRS feed

  • Question

  • Is there a way of pushing an already created database connection to the sync services framework?  I'm running into an issue where I'm building the sync services on a seperate thread, and SqlCE is upset, since I'm trying to use it as if it is on the same thread.

     

    Any help would be appreciated.  Thanks.

    • Moved by Max Wang_1983 Friday, April 22, 2011 6:34 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, August 6, 2008 6:04 PM

Answers

  • Hello

     

    When you compile your project, do you reference

    %Program Files\Microsoft Sync Framework\v1.0\Runtime\ADO.NET\V2.0\x86\Microsoft.Synchronization.Data.dll

    instead of %Program Files%\Microsoft Synchronization Services\ADO.NET\v1.0\Microsoft.Synchronization.Data.dll?

     

    Can you try rebuilding you project with the V1.0 assembly and run your application with V1 assemblies in the same folder?

     

    Also what is the business scenario you have tried to get working, have user's DML and synchronization working at the same time? 

     

    Thanks

     

    Friday, August 8, 2008 4:50 AM
    Answerer
  • Sorry Yunwen...

     

    Yes, I needed to link to the correct libraries... when I was testing this, it was a mix of the 1.0 Sync services for ADO.Net, and some CTP stuff, as well as one library from the Sync Services 1.0 Framework.

     

    Thought that VS would have cleaned things up, but i was wrong with this... need to go back to developing without an IDE.... becoming a very lazy programmer Wink

     

    I should add though... I have to close my main connection from the OR/M Framework (DevExpress XPO Suite) before the sync will work.  Need to figure out how to pass an IDbConnection to the Sync Framework, or pass the IDbConnection from the Sync Framework to the OR/M Suite so that they can share the connection.  A bad limitation for developing systems of this calibur.

     

    How does Outlook handle connections, since Outlook performs about the same functionality that I'm working on developing?

     

    Thanks.

    Wednesday, August 13, 2008 2:34 AM

All replies

  • SO...

     

    To update this a bit.  I've realized that I can perform a DoEvents, thereby avoiding the need for a seperate thread (I don't like this idea, but like the idea more that I'm using the Compact Framework, so I'll deal as long as we don't get too may support issues when Sync Services goes RTM).  My next question is how can I push the IDbConnection into the Sync Services, or do I still need to lock the user out of interracting with the system during the sync?  I have not yet found a way of doing this, and it's hurting the look of the overall performance of the system.

     

    I'm trying to keep it so that it feels like you are working in Microsoft Outlook if that is possible.  For some reason, my OR/M framework keeps the connection open (DevExpress).

    Wednesday, August 6, 2008 6:51 PM
  • running sync in a seperated thread is supported. what error did you see ? could you check if the sync uses a seperated dbconnection object ? or it shares the connection object with other thread ?

     

    thanks

    Yunwen

    Thursday, August 7, 2008 12:35 AM
    Moderator
  • The error that comes up is...

    There is a file sharing violation. A different process might be using the file. [ C:\src\Deal Processor\BidTool.UI.Client\ClientDb.sdf ]

     

    When I researched this out, I found out that there is a limitation on Sql Compact Edition 3.5 that doesn't allow more than one process to create a connection to the datastore.

     

    I am using DevExpress' XPO suite to handle OR/M, and then I am using the sync services framework to handle moving the data between the clients and home office.

     

    I was trying to figure out how to either use XPO's connection to assign to the Sync Services framework code, or vica versa... but no dice so far on either case.

     

    Thanks Yunwen.

    Thursday, August 7, 2008 6:22 AM
  • Ok...

    With the release of everything that is needed to run Sync Services for ADO.Net 2, I upgraded everything on my machine, including Sql Server Compact 3.5 SP1.

     

    The compile seems to be going well, and I am no longer getting the above error as previously stated... I'm running into a new beut, which is:

    Method not found: 'Microsoft.Synchronization.Data.SyncException Microsoft.Synchronization.Data.SyncExpt.AnotherSyncInProgressError(System.String, System.String)'.

     

    Can someone tell me if there are issues with the library stack, or if there is something else I can look at for this?

    Friday, August 8, 2008 2:09 AM
  • I've uploaded a screenshot of the error dialog that comes up when running the code in debug mode...

     

    http://www.nerdzonline.net/images/AnotherSyncInProgressError.jpg

     

    I'm hoping that posting this image may indeed help out some with understanding what I am seeing... My theory is that there is a *.dll library missing somewhere.

     

    I'm going to build a fresh project to see if maybe there's something funny going on.  I'll update on what I find out.

     

    Thanks.

    Friday, August 8, 2008 3:09 AM
  •  

    in your case, are there two ( or more ) concurrent sync sessions agaist the same client db ?

     

    we explictly block mutiple syncs with the same client database in the sqlceclient provider. but the exception you encountered seems not very meaningful.

     

    could you check the exceptions details, such as inner exception?

     

    thanks

    Yunwen

    Friday, August 8, 2008 4:06 AM
    Moderator
  • Hello

     

    When you compile your project, do you reference

    %Program Files\Microsoft Sync Framework\v1.0\Runtime\ADO.NET\V2.0\x86\Microsoft.Synchronization.Data.dll

    instead of %Program Files%\Microsoft Synchronization Services\ADO.NET\v1.0\Microsoft.Synchronization.Data.dll?

     

    Can you try rebuilding you project with the V1.0 assembly and run your application with V1 assemblies in the same folder?

     

    Also what is the business scenario you have tried to get working, have user's DML and synchronization working at the same time? 

     

    Thanks

     

    Friday, August 8, 2008 4:50 AM
    Answerer
  • No inner exception in window details.

     

    Message was:

    "Method not found: 'Microsoft.Synchronization.Data.SyncException Microsoft.Synchronization.Data.SyncExpt.AnotherSyncInProgressError(System.String, System.String)'."

     

     

    Source:

    "Microsoft.Synchronization.Data.SqlServerCe"

     

     

    Stack Trace:

       at Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.BeginTransaction(SyncSession syncSession)
       at Microsoft.Synchronization.SyncAgent.DataSynchronize()
       at Microsoft.Synchronization.SyncAgent.Synchronize()
       at BidTool.UI.Client.frmMainV2.bkgndSync_DoWork(Object sender, DoWorkEventArgs e) in C:\src\Deal Processor\BidTool.UI.Client\frmMainV2.cs:line 149
       at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
       at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

     

     

    Microsoft.Syncronization is linked from c:\Program Files\Microsoft SDKs\Microsoft Sync Framewokr\v1.0\Runtime\x86\Microsoft.Syncronization.dll

    Microsoft.Syncronization.data is linked from c:\Program Files\Microsoft SDKs\Microsoft Sync Framewokr\v1.0\Runtime\ADO.NET\V2.0\x86\Microsoft.Syncronization.Data.dll

    Microsoft.Syncronization.Data.Server is linked from c:\Program Files\Microsoft SDKs\Microsoft Sync Framewokr\v1.0\Runtime\ADO.NET\V2.0\x86\Microsoft.Syncronization.Data.Server.dll

    Microsoft.Syncronization.Data.SqlServerCe is linked from c:\Program Files\Microsoft Syncronization Services\ADO.NET\v1.0\Microsoft.Syncronization.Data.SqlServerCe.dll

     

    shouldn't these files exist somewhat in the same folders?

    Friday, August 8, 2008 5:43 AM
  • I need to slow down and read more... thought that the installers would have updated the links in the system.

     

    THanks.

     

    ... now if I can only figure out this 2x connections problem...

     

    Friday, August 8, 2008 5:47 AM
  • any update for this issue folks ?

     

    thanks

    Yunwen

     

    Tuesday, August 12, 2008 5:08 AM
    Moderator
  • Sorry Yunwen...

     

    Yes, I needed to link to the correct libraries... when I was testing this, it was a mix of the 1.0 Sync services for ADO.Net, and some CTP stuff, as well as one library from the Sync Services 1.0 Framework.

     

    Thought that VS would have cleaned things up, but i was wrong with this... need to go back to developing without an IDE.... becoming a very lazy programmer Wink

     

    I should add though... I have to close my main connection from the OR/M Framework (DevExpress XPO Suite) before the sync will work.  Need to figure out how to pass an IDbConnection to the Sync Framework, or pass the IDbConnection from the Sync Framework to the OR/M Suite so that they can share the connection.  A bad limitation for developing systems of this calibur.

     

    How does Outlook handle connections, since Outlook performs about the same functionality that I'm working on developing?

     

    Thanks.

    Wednesday, August 13, 2008 2:34 AM