In order to use the transaction facility your controllers need to be instantiated by the container. Also check out the Kym project you linked to earlier.
On Sun, Dec 14, 2008 at 8:32 PM, Bart Reyserhove <[email protected]>wrote: > > http://code.google.com/p/winecellarmanager/source/browse/#svn/trunk/WineCellarManagerOnASPNETMVC > Do not only check the Binsor but also the ControllerFactory and the > global.asax. > > > On Sun, Dec 14, 2008 at 8:03 PM, Chris Hoffman > <[email protected]>wrote: > >> >> No, I didn't know that was necessary. Is there an example of such a >> configuration? >> >> On Sun, Dec 14, 2008 at 1:46 PM, Bart Reyserhove >> <[email protected]> wrote: >> > Do you register your controllers in Binsor? >> > >> > On Sun, Dec 14, 2008 at 6:34 PM, Chris Hoffman < >> [email protected]> >> > wrote: >> >> >> >> I took out the HandleError attribute, but no error is being returned. >> >> I simply get no transaction commit after a request is completed. >> >> >> >> @Simone: do I need something in the windsor.boo that indicates what >> >> controllers make use of the RhinoTransactionFacility? >> >> >> >> Thanks. >> >> >> >> On Sun, Dec 14, 2008 at 9:58 AM, Simone Busoli < >> [email protected]> >> >> wrote: >> >> > Where are you registering the controllers in the container? >> >> > >> >> > On Sun, Dec 14, 2008 at 2:35 PM, Bart Reyserhove >> >> > <[email protected]> >> >> > wrote: >> >> >> >> >> >> Can you elaborate a little more on the exact problem you're having. >> Is >> >> >> it >> >> >> the commit or rollback part? >> >> >> I see you have a "HandleError" attribute as well on your controller. >> It >> >> >> could be that that is causing an issue because the Controller does >> not >> >> >> actually throw an exception. That of course depends on the >> >> >> implementation of >> >> >> the HandleError attribute. >> >> >> We experienced that problem in our project. >> >> >> >> >> >> On Sun, Dec 14, 2008 at 2:22 PM, Chris Hoffman >> >> >> <[email protected]> >> >> >> wrote: >> >> >>> >> >> >>> 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. >> >> >>> >> >> >>> >> >> >> >> >> >> >> >> >> >> >> > >> >> > >> >> > > >> >> > >> >> >> >> >> >> >> >> -- >> >> "Injustice anywhere is a threat to justice everywhere." >> >> Martin Luther King, Jr. >> >> >> >> >> > >> > >> > > >> > >> >> >> >> -- >> "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 -~----------~----~----~----~------~----~------~--~---
