Information générale
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Network:
Windows 2003 Server
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
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement