Hi there,

I've found some useful tips on using CallContext to link multiple
transactional methods (in this same list and CodeProject, thanks Craig
Andera and Deyan) . With this I modified my previous shared transaction
version, adding a few shared methods to join/rollback/commit the actual
CallContext transaction. Example:

ClassA.Insert Method
        (...)

        SharedTransaction.Current_Connect(ConnectionString)

        (...)

        SharedTransaction.Current_IncludeCommand(MySQLCmd)

        MySLCmd.ExecuteNonQuery

        SharedTransaction.Current_Commit

        (or)

        SharedTransaction.Current_Rollback



Currently I have one limitation of one transaction per callcontext,  I'm not
needing more than one anyway... at lest for now.

To identify the root method I am now using StackFrame ILOffset, this way I
can call other methods on the same class without having to create a new
instance, they will have a chance to vote commit/rollback independently.

I'm not implementing ILogicalThreadAffinitive, because  I think I won't need
to pass my transactions across different AppDomains. The reason that I'm
using call context and not a shared class member for storing the transaction
is that I really need to pass it between different classes, CallContext
seemed a better option to me after reading the sdk docs.

As anyone tried this for real? Are there known problems/limitations with
this approach?

Thanks in advance,

RQ

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to