Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transactions with Child-Parent-Grandparent
Message
From
27/09/2005 16:40:42
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01053421
Message ID:
01053641
Views:
10
Jim,

I always let the biz objects handle the transactions by setting the following properties on the biz objects.

AutoUseTransactions = True
AutoSaveOnParentSaved = True
AutoCancelOnParentCancel = True

The framework will initialize the transaction and pass it to all the child, grandchild... objects. If SaveDataSet fails the transaction is rolled back.

Hope this helps.

Terry Carroll






>I am using the Mere Mortals business objects to control transactions with related business objects.
>1) In my test I relate a child business object to a parent business object and relate the parent to a grandparent business object.
>2) I get an empty dataset into each of the business objects
>3) I add a new record to each of the datasets
>4) I start a transaction on the grandparent object with TransactionBegin()
>5) I call SaveDataSet() on the grandparent, which automatically calls it on the parent and child objects
>6) I rollback the transaction by calling TransactionRollback() on the grandparent.
>
>I would expect this to rollback the new records in all 3 tables. It does rollback on the grandparent and parent tables, but leaves the new record in the child table.
>
>I thought maybe the transaction was only good in 2 generations (the parent and grandparent) so I tried to simultaneously start another transaction at the parent level so I could rollback both transactions in my test. But I get an error saying that the connection cannot have multiple transactions open in it.
>
>Any thoughts?
>
>Matthew J. Price
Previous
Reply
Map
View

Click here to load this message in the networking platform