Do I need something like this?

http://code.google.com/p/kym/source/browse/trunk/src/Kym.Web/TransactionAttribute.cs

On Sat, Dec 13, 2008 at 5:45 PM, Chris Hoffman
<[email protected]> wrote:
> Hello,
>
> I'm having a bit of trouble trying to get the UoW to flush after a
> single request.  Could someone please point me in the right direction
> as far as what I'm doing incorrectly?
>
> Here is my Controller (only the important parts, so far as I can glean):
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Web;
> using System.Web.Mvc;
> using System.Web.Mvc.Ajax;
> using System.Web.Routing;
> using Castle.ActiveRecord;
> using Castle.Services.Transaction;
> using Rhino.Commons;
> using AirModel.Models;
> using NHibernate.Criterion;
> using TransactionMode=Castle.Services.Transaction.TransactionMode;
>
> namespace AirModel.Controllers
> {
>    [HandleError, Authorize,Transactional]
>    public class ReportController : Controller
>    {
>        public IRepository<Report> ReportRepo { get; private set; }
>        private Report _rpt;
>
>        public ReportController() : this( IoC.Resolve<IRepository<Report>>()) 
> {}
>
>        public ReportController( IRepository<Report> rptRepo) {
> ReportRepo = rptRepo; }
>
> ...
>
>        [Transaction(TransactionMode.Requires)]
>        public virtual ActionResult Update()
>        {
>            _rpt = ReportRepo.Get(int.Parse(Request.Form["ID"]));
>
>            ...
>
>            ReportRepo.SaveOrUpdate(_rpt);
>            return View("Edit");
>        }
> ...
> -----------
>
> Here is my windsor.boo:
>
> import Rhino.Commons
> import System.Reflection
> import Castle.Core
> import Castle.Services.Transaction
> import Castle.Facilities.AutomaticTransactionManagement
>
> import Rhino.Commons from Rhino.Commons.NHibernate as nh
> facility  "transaction.facility", RhinoTransactionFacility
>
> Component("active_record_repository", IRepository, ARRepository)
>
> Component("active_record_unit_of_work",
>    IUnitOfWorkFactory,
>    ActiveRecordUnitOfWorkFactory,
>    assemblies: ( Assembly.Load("AirModel"), ) )
> -----------
>
> Here is the relevant slice of my Global.asax.cs:
>
>    public class MvcApplication :
> Rhino.Commons.HttpModules.UnitOfWorkApplication
> -----------
>
> Thanks.
>
> -Chris
>



-- 
"Injustice anywhere is a threat to justice everywhere."
  Martin Luther King, Jr.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to