TransactionScope - XP SP2 Issues & What's the best way to handle it?

TransactionScope - XP SP2 Issues & What's the best way to handle it?

Old forum URL: forums.lhotka.net/forums/t/4451.aspx


Pawz posted on Monday, March 03, 2008

I've been working with the CSLA 3.0 framework for a while, and I've just recently bumped into the whole XP is missing the DTC service 'security' feature from MS, where my child object errors out when its parent updates, because the transaction is upgraded to a distributed transaction.

How are you guys handling this? There is the option of passing the command object through to every child, and there is the option of turning on the DTC service on the machine.

I haven't been able to find a good way to turn on the DTC service for all xp machines on the domain, which is the primary reason I haven't gone that route yet. In any case, what would be the 'best practice' recommended here?




JoeFallon1 replied on Monday, March 03, 2008

I use manual transactions.

I have some code (which I posted here before) which creates the tr and stores it in the Local Context.

Then as each object calls Begin Transaction the code checks to see if they should enlist in the already running tr. If there is no tr in context, then it starts one, otherwise it returns the existing tr.

I did this so that different root BOs could use the same tr. It works nicely.

My templates for Child BOs were fine so I never updated them to reflect any of this. That means they pass the tr from root to child collection to child as a parameter. It is still the same tr so everything works out in the end.

Joe

 

stanc replied on Monday, March 03, 2008

I may be wrong, but I believe you only need the DTC service enabled on the machines accessing the db. So, if you are going to use an application server then only that server will need the service enabled. For development purposes where often times everything is running on the developer's machine, you will also need to enable it on those machines as well.

If I'm wrong about this, hopefully someone will set the record straight.

hth  -stan

ajj3085 replied on Wednesday, March 05, 2008

Each child object should be using the connection opened by the root object.  You can either pass it explicity, or you could put it in the LocalContext.  As long as you're only opening one connection the transaction won't be promoted to DTC, which is good because DTC slows things down quite a bit.

Copyright (c) Marimer LLC