Expected Transaction Behavior (SQL Server 2000)?

Expected Transaction Behavior (SQL Server 2000)?

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

cmay posted on Saturday, January 30, 2010

I used code generation to create a large number of business objects. In the "Save" of these business objects, the procedure is wrapped in a TransactionalTypes.TransactionScope attribute.

I use the ConnectionManager and do all my save work inside the using block.

All was well.

Then today we deployed an app that at times talks to a SQL Server 2000 machine (in develoment, these databases are all run on 2008) and the transactions started failing all over the place.

Transactions are failing becaues MSDTC trans are being created and MSDTC doens't work in this environment.

So my question is 2 fold:
1) Should a connection to a SQL Server 2000 database, from inside a method with the TransactionalTypes.TransactionScope attribute, automatically create attempt an MSDTC transaction, even if it is the first connection to the DB?

2) Is there anyway to change the TransactionalTypes.TransactionScope value from within code? What I mean is lets say you have a method with that attribute which calls another method, and before the DB connection is opened, you run some line of code that basically cancels out the attribute so that no transaction is created. Is there anything like that?

RockfordLhotka replied on Saturday, January 30, 2010

I don't think System.Transactions fully supports SQL 2000.

Please remember that CSLA doesn't implement any transactional behavior - it is simply tapping into the existing .NET transactional models (TransactionScope or Enterprise Services). So whatever you can or can't do with System.Transactions.TransactionScope is what you can do in CSLA when using that technology.

If you want runtime control over your transactional model, you need to tell CSLA you want Manual transactions, and then implement the transactional behavior in your code.

tetranz replied on Saturday, January 30, 2010

For what it's worth, I'm successfully using System.Transaction with SQL 2000 using the technique describe here. http://blogs.msdn.com/florinlazar/archive/2005/09/29/475546.aspx

Some helpful person pointed me there a few years ago Smile [:)]


RockfordLhotka replied on Saturday, January 30, 2010

OK, so I'm getting old, don't remind me! Embarrassed [:$]

Copyright (c) Marimer LLC