Re: Database transactions and data-state flags
- From: "Craig Buchanan" <someone@xxxxxxxxxxxxx>
- Date: Wed, 1 Nov 2006 10:58:53 -0600
Can you elaborate on now MTS would handle this? would the need for flags be
removed? would each object need to handle its own persistence?
Thanks.
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:IKKdnT9-gMvvUtXYnZ2dnUVZ_qudnZ2d@xxxxxxxxxxxxxxx
"Craig Buchanan" <someone@xxxxxxxxxxxxx> wrote in message
news:e4G%23U6c$GHA.204@xxxxxxxxxxxxxxxxxxxxxxx
I am attempting to create an API layer for my application. The UIinteracts
with the API, the API interacts with the database.point,
Essentially, each object is responsible for its persistence. At this
I use flags (IsNew or IsDirty) to indicate the state data of the object'sto
data. When the data has been saved successfully to the database, the
flags
are switched off. This works fine for a simple object.
If, however, I have an object that has collections, the state management
becomes more complex. Consider an Invoice object that has a LineItems
collection of LineItem objects. I want to create a database transaction
ensure that the hierarchy is save successfully as a whole. It seems thatI
need to follow this logic:
* create a transaction
* save the Invoice, if necessary
* iterate the LineItems collection, save the LineItem, if necessary
* commit the transaction
* reset the Invoice's flags
* iterated the LineItems collection, reset each LineItem's flags
I don't want to reset the LineItem's flags during the database update
process; if the transaction fails, the flags' settings wouldn't match the
data's true state.
Does this seem reasonable? Is there an alternate approach to this that
avoids flags?
Thanks for your thoughts.
Craig Buchanan
Why not use MTS (COM+). That's what it was designed for.
But like Mr. Hyde said - there ain't wrong with flags.
-ralph
.
- Follow-Ups:
- Re: Database transactions and data-state flags
- From: Ralph
- Re: Database transactions and data-state flags
- References:
- Database transactions and data-state flags
- From: Craig Buchanan
- Re: Database transactions and data-state flags
- From: Ralph
- Database transactions and data-state flags
- Prev by Date: Register OCX
- Next by Date: Re: Register OCX
- Previous by thread: Re: Database transactions and data-state flags
- Next by thread: Re: Database transactions and data-state flags
- Index(es):
Relevant Pages
|