question

rquigley23 avatar image
rquigley23 asked

Link CDC transaction to c# transaction id

We have CDC enabled on certain tables we would like to track. I can get the cdc change data using the cdc funcions like fn_cdc_get_all_changes_ and I can see transaction ids in the cdc.lsn_time_mapping table. Changes to the database are generated from our wcf services operation written in c#. We would like to map all changes in a service call that happen in one TransactionScope back to that service operation. So in c# I can get a transaction id inside a transaction scope using: TransactionInformation info = Transaction.Current.TransactionInformation; transactionId = Guid.Empty == info.DistributedIdentifier ? info.LocalIdentifier : info.DistributedIdentifier.ToString(); These transaction ids look like: 97586a54-674f-48bf-b41a-b420459c1c26:383 a0416d9a-312f-4245-b8c5-98980ed644fa:290 Are these transaction Id's stored anywhere in the CDC? If not is there anyway that I can query the transaction id that will be created in SQL server and save the mapping. I need a way to map the database transaction to the transaction I'm creating in c# (if they are not the same thing?) either at the time I am doing the update in code or by quering CDC / transaction logs. Thanks for your help! Ryan
transaction-logc#change-data-capturecdc
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.