none
Creating multiple scopes on same table RRS feed

  • Question

  • Hello,

            If I define multiple scopes (say 5) on single table with different criteria, does it create multiple SelectChanges SPs for each criteria?

     

    -Ajinath

    Monday, May 31, 2010 10:38 AM

Answers

  • did you set the DbSyncScopeDescription to a different name? I forgot to mention, scope names must be unique.
    Monday, May 31, 2010 12:37 PM
    Moderator

All replies

  • afaik, yes (am assuming same table/columns just different filter criteria). just make sure to set SetCreateProceduresForAdditionalScopeDefault to Create and all the other SetCreate methods to Skip when adding an additional scope. the additional SelectChanges stored procs will have a unique identifier suffixes.
    • Edited by JuneTModerator Monday, May 31, 2010 12:26 PM
    • Proposed as answer by Ali Bazzal Thursday, September 5, 2013 9:50 AM
    Monday, May 31, 2010 11:44 AM
    Moderator
  • Thanks JuneT for the answer and additional information.

    I tried accrodingly but getting an exception : Violation of PRIMARY KEY constraint 'PK_scope_info'. Cannot insert duplicate key in object 'dbo.scope_info'.
    The statement has been terminated.

    Here is the code :

    serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
                    serverConfig.SetCreateProceduresForAdditionalScopeDefault(DbSyncCreationOption.Create);
                    serverConfig.SetCreateTrackingTableDefault(DbSyncCreationOption.Skip);
                    serverConfig.SetCreateTriggersDefault(DbSyncCreationOption.Skip);
                    serverConfig.SetCreateProceduresDefault(DbSyncCreationOption.Skip);

                    //provision the server
                    serverConfig.Apply((System.Data.SqlClient.SqlConnection)provider.Connection);

    what am I doing wrong?

    Also does creating multiple scopes, creates other sync objects (triggers, and other SPs : _delete, _insert, _selectrow, .....)too?

     

    -Ajinath

    Monday, May 31, 2010 11:58 AM
  • did you set the DbSyncScopeDescription to a different name? I forgot to mention, scope names must be unique.
    Monday, May 31, 2010 12:37 PM
    Moderator