Out of curiosity, why do you recommend ATM over With.Transaction? On Fri, Mar 20, 2009 at 8:29 AM, Ayende Rahien <[email protected]> wrote: > That is the expected behavior. You can either use ATM or With.Transaction > I recommend ATM > > On Fri, Mar 20, 2009 at 11:24 AM, Filip Kinsky <[email protected]> wrote: >> >> I just started new MS MVC project and wanted to use >> UnitOfWorkApplication. The application works ok until I want to write >> some changes to DB. I thought the UnitOfWorkApplication will >> automatically flush and commit all changes I made to DB if no >> exception is thrown, but it doesn't work like that in my project. Do I >> need to use With.Transaction in my write-controllers/actions/services >> or Castle ATM etc or should the UoWApp work as I mentioned (flush >> +commit on request end)? >> >> I currently have controller action like this, but no changes are >> persisted in DB when I invoke the action. >> >> public JsonResult CreateSomeUser() >> { >> var u = userAdminService.CreateNewUser("userX", >> "x", "x", "x"); >> return Json(new {success = true, id = u.Id}); >> } >> >> ... >> >> public User CreateNewUser(string username, string password, >> string >> firstName, string lastName) >> { >> var u = new User(username) >> { >> PasswordHash = >> GetPasswordHash(password), >> FirstName = firstName, >> LastName = lastName >> }; >> userRepo.Save(u); >> return u; >> } >> > > > > >
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
