I would delegate the save to another transactional method, something like
this:
Save(Entity e)
if (e.IsValid) {
try {
dao.Save(e)
}
catch {
flash[xxx] = e
redirect back to edit
}
redirect somewhere
}
else {
do something when entity is not valid
}
then apply the Transaction attribute to dao.Save
On Thu, Apr 16, 2009 at 3:59 PM, Felix Gartsman <[email protected]> wrote:
>
> Hello,
> I'm trying to improve my save/update entity handling scenario by using
> ATM. Now I use the following pseudo-method:
> Save(Entity e)
> success = false
> if(e.IsValid)
> start trans
> try
> e.Save
> commit
> success = true
> catch ... end
>
> if not success
> flash[xxx] = e
> redirect back to edit
> else
> redirect somewhere
>
> Say I leave transaction start/commit to ATM, how do I handle commit
> errors? It's out of the method code, so I don't have (easy) access to
> parameters to fill the flash and redirect back to form with the user
> filled values. Do I need to resort to writing filters (and adjusting
> them per controller/entity)? Which is no better than my current
> solution.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---