locked
Accessing SyncParameter collection from ServerSyncProvider OnInitialized RRS feed

  • Question


  • I'm just wondering how to get hold of SyncParameter collection from the ServerSyncProvider OnItitialized event. I can't seem to work out how to get hold of session information within this event and I want to do some logic based on the value of one of the sync parameters before selecting incremental inserts/updates.

    Basically, I am passing a build number (of my client app) to the sync server and then doing some conditional logic to return a select list based on which version of the app is being used as I am releasing a new version and don't want to break older versions.

    At the moment, I am trying to do something like this:

    // Grab the BuildNumber from sync parameter collection
                string Build98_AdditionalColumns = "";
                SyncConfiguration con = new SyncConfiguration();
                int BuildNumber = (int)con.SyncParameters["BuildNumber"].Value;
                if (BuildNumber >= 98)
                {
                    Build98_AdditionalColumns = "i.IncidentID, a.AreaID, st.ServiceTaskID, "; 
                }
    
    Basically, I'm trying to get the sync parameter from the collection, but not sure where to get it from within the OnItialized event. Yes, I could create a SQL param and plug @BuildNumber into it, but I'd prefer to grab the value from the parameter collection and do outside of SQL.

    Any help greatly appreciated,

     
    • Moved by Max Wang_1983 Thursday, April 21, 2011 12:26 AM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Friday, October 2, 2009 2:54 PM

Answers

  • As you described in the msg above, the best place to put such logic is in the procedures and use this as the commands on the sync adapters.


    thanks
    Yunwen


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, October 5, 2009 9:53 AM
    Moderator

All replies


  • In MSDN, the parameters are plugged in 'under the surface':
    customerIncrInserts.Parameters.Add("@SalesPerson"
    
    
    
    
    
    , SqlDbType.NVarChar);
    It doesn't show you how to access the underlying collection. How do I do conditional logic based on the value of @SalesPerson (without using stored procedures and outside of SQL)?

    Friday, October 2, 2009 3:07 PM
  • As you described in the msg above, the best place to put such logic is in the procedures and use this as the commands on the sync adapters.


    thanks
    Yunwen


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, October 5, 2009 9:53 AM
    Moderator
  • ok, thanks... if there's no other way of doing.
    Tuesday, October 6, 2009 1:10 PM