SelectionDelegate examples

jbaggaleyjbaggaley Posts: 38
edited April 1, 2006 6:46PM in SQL Toolkit Previous Versions
Does anyone know where there is a good example of using SelectionDelegate? We have a database containing sales information relevant to specific reps and I only want to synchronise the information relevant to them and anyone beneath them (in the case of a manager). Looking through the documentation, creating SelectionDelegate is mentioned as a method for partitioning/choosing records but there are not many samples so that I can see whether the technique would work for me. Is there a better way of choosing such as filtering by a specific field? Will the synchronisation process go through the entire table to find missing/outdated records or can it be told to use a specific key field and cut the processing time down?




  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hello Jon,

    Yes, here is one example: ... horizontal

    I have some pre-built projects I can also send if you email [email protected] and ask nicely.
  • I am fairly new to the toolkit but I am trying to use the SelectionDelegate to perform some replication like decisions about what rows will be added to the resulting script. I have looked at the sample and it is helpful. The missing piece is that the sample does not compare values (i.e. a datetime stamp) between the two tables/rows being compared. It only checks for the presense of a field and that it has a certain value. This is more like a filtered one-way synchronization than a two-way replication based on user-defined comparisons. To do a more replication like synchronization, I am guessing that the comparison could be done using the ResultStore of the DifferentRecords and then some indication of the direction for the update could be added to the SyncInfo collection. In addition, two calls to the GetMigrationSQL method would be required; one for each direction. My question is: will the bookmarks stay the same for both GetMigrationSQL calls? This way, the difference rows could be processed only once.

    What would make this much easier would be if a property of the SelectionDelegate object was the row being examined. Then, the comparison code could be in the delegate rather than before the GetMigrationSQL call. Alternately, the delegate could be modified or a different kind of delegate could be specified that had two parameters (the SynchronizationRecord and the DifferenceRow.

    If you have some code that more closely resembles replication, could you post it somewhere?

Sign In or Register to comment.