And where are you getting the exception?
2009/10/6 Vadim Kantorov <[email protected]>
>
> public class TransactionPerRequest : ActionFilterAttribute
> {
> public override void
> OnActionExecuting(ActionExecutingContext
> filterContext)
> {
> filterContext.HttpContext.Items["transaction.key"] =
> new
> TransactionScope();
> }
>
> public override void OnActionExecuted(ActionExecutedContext
> filterContext)
> {
> Debug.Assert(filterContext.Exception == null);
> var scope = (TransactionScope)
> filterContext.HttpContext.Items
> ["transaction.key"];
> scope.Complete();
> scope.Dispose();
> }
> }
>
> On 7 окт, 02:55, Simone Busoli <[email protected]> wrote:
> > Post the code for the action filter.
> >
> > 2009/10/6 Vadim Kantorov <[email protected]>
> >
> >
> >
> >
> >
> > > Though it's all ok if i put the TransactionScope stuff in the action
> > > itself.
> > > Something must be hidden.
> > > Any ideas?
> >
> > > On 7 окт, 02:48, Vadim Kantorov <[email protected]> wrote:
> > > > It didn't work out. Now I'm starting and closing the transaction
> scope
> > > > in an action filter. The Exception property is null. So no hidden
> > > > exception occured. The same InvalidOperationException is thrown.
> >
> > > > On 5 окт, 01:04, Corey Kaylor <[email protected]> wrote:
> >
> > > > > Since you're using ASP.NET MVC, have you considered trying
> something
> > > like a
> > > > > TransactionActionFilter? Something that is similar to what is
> > > > > described here<
> > >http://hackingon.net/post/NHibernate-Session-Per-Request-with-ASPNET-..
> .>
> > > > > but
> > > > > replacing the NHibernate transaction with TransactionScope. That
> will
> > > give
> > > > > you access to check whether any exceptions occurred during the
> request.
> > > It
> > > > > also allows you to be more explicit about which requests do and
> don't
> > > have
> > > > > transactions.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" 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/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---