Re: [Proposal] using statement enhancements
From: Helge Jensen (helge.jensen_at_slog.dk)
Date: 03/05/05
- Next message: Adrian: "Re: socket programming"
- Previous message: Dani: "How restrict some assembly"
- In reply to: cody: "[Proposal] using statement enhancements"
- Next in thread: Jon Skeet [C# MVP]: "Re: [Proposal] using statement enhancements"
- Reply: Jon Skeet [C# MVP]: "Re: [Proposal] using statement enhancements"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 05 Mar 2005 14:33:53 +0100 To: cody <deutronium@gmx.de>
> The second idea I have is that we need some support for transactions in
> code. Currently we have to write huge statements like that to enable safe
> transaction handling:
The usual idiom is something like:
Transaction t = Transcations.Begin(...);
bool committed = false;
try {
while ( still_not_done() )
t.Operate(...);
committed = t.Commit();
} finally {
if ( !committed )
t.Rollback();
}
Which nicely lets exception go to the caller of something goes wrong,
and completes cleanly otherwise.
-- Helge
- Next message: Adrian: "Re: socket programming"
- Previous message: Dani: "How restrict some assembly"
- In reply to: cody: "[Proposal] using statement enhancements"
- Next in thread: Jon Skeet [C# MVP]: "Re: [Proposal] using statement enhancements"
- Reply: Jon Skeet [C# MVP]: "Re: [Proposal] using statement enhancements"
- Messages sorted by: [ date ] [ thread ]