none
The Configuration method is currently not supported by RelationalSyncProvider. RRS feed

  • Question

  • Hello

    I try to sync a Sql Compact database and a Sql Express. In a sync scope I have 2 table: Transaction and TransactionLine, that contains a foreign key.

    During an upload operation from SqlCompact to SqlExpress I receive the following error:

    Column 'TransactionLineNo' is constrained to be unique.  Value 'c1b6951a-18e7-4dc2-a256-e5ff319a05ee' is already present. This happens in TransactionLine_tracking table.

    The SqlSync Provider trows this error:

    The Configuration method is currently not supported by RelationalSyncProvider.  The Sync Framework database providers do not support this feature.  This feature is available by implementing a custom provider.

    at Microsoft.Synchronization.Data.RelationalSyncProvider.get_Configuration()

    I based my implementation on this sample.

     


    sb_angela
    Friday, November 18, 2011 7:44 AM

All replies

  •  any customization you made on the sample code other than the tables and scope names?

    have you checked if the value its complaining about is existing in the destination database?

    Friday, November 18, 2011 8:50 AM
    Moderator
  • Hello

    When I provision the compact database, I do not require a connection to the sql express server, I have something like this

    public static void ProvisionDatabase(SqlCeConnection localConnection, string scopeName)
    {
        SqlCeSyncScopeProvisioning scopeProvision = new SqlCeSyncScopeProvisioning(localConnection);
    
        //scope does not exist=> start the provisioning process for the first time
        if (!scopeProvision.ScopeExists(scopeName))
        {
            //get the description
            DbSyncTableDescription tableTransactionDesc = SqlCeSyncDescriptionBuilder.GetDescriptionForTable("Transaction", localConnection);
            DbSyncTableDescription tableTransactionLineDesc = SqlCeSyncDescriptionBuilder.GetDescriptionForTable("TransactionLine", localConnection);
    
            //define a new scope add the table description to the sync scope definition
            DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(scopeName);
            scopeDesc.Tables.Add(tableTransactionDesc);
            scopeDesc.Tables.Add(tableTransactionLineDesc);
    
            scopeProvision.PopulateFromScopeDescription(scopeDesc);
            scopeProvision.Apply();
        }
    }
    

    The value exist both in TransactionLine and TransactionLine_tracking table, but it is not uploaded to the server.
    I also looked a bit deeper in the error and it reads something like this : Method may only be called on a Type for which Type.IsGenericParameter is true.

    The strange part is that it works ok one time: I add data through the client, I sync and I have them on server. The next time start the client, add some data and sync I receive this error.


    sb_angela
    Friday, November 18, 2011 9:26 AM
  • what's the pk for both tables?
    Tuesday, November 22, 2011 4:01 AM
    Moderator
  • Hello

    The PK for both tables is uniqueidentifier.

    I believe I figured out the problem: from code I add a record then delete it and add it again with the same Guid that was previously assign to the deleted record.

    I think this scenario fits to the error I receive: "Column 'TransactionLineNo' is constrained to be unique.  Value 'c1b6951a-18e7-4dc2-a256-e5ff319a05ee' is already present." especially because it happens on the _tracking table.

    I still need to run some tests, to be sure that this is the problem.

    Angela

     

    Tuesday, November 22, 2011 8:46 AM
  • you should be able to delete and insert another row with the same pk. but let's see how it goes with your testing....
    Tuesday, November 22, 2011 1:00 PM
    Moderator
  • Hello

    On SQL Compact side: I create a row, delete it and add it again with the same Pk, and the same data. When I try to upload data from sql compact I receive the above error message.

    Why does this happen?

    The fix was simple, I use another guid for my data.

    Angela.

     

     


    sb_angela
    Wednesday, November 23, 2011 7:59 AM
  • just to clarify, do you sync after you insert and delete before you re-insert the same pk?

    or is it insert, delete, insert, sync?

    i just needed the exact steps so i can reproduce.

    Wednesday, November 23, 2011 8:04 AM
    Moderator
  • This are the steps: insert, delete, insert and then try to sync the data (direction: upload from sql compact to sql express).
    sb_angela
    Wednesday, November 23, 2011 3:02 PM