I guess you're on winforms? Take a look at ConversationalScope and ScopedConversation.
There was an article on it somewhere, but I think it got lost in the move to the new docs site. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Christian Axelsson Sent: 30 March 2011 10:42 AM To: [email protected] Subject: AR and a stale transaction Hello, I try to persist an entity to database using myEntityRepository.Save(myEntity); // This will end up calling ActiveRecordMediator.Save(entity); SessionScope.Current.Flush(); By configuring AR to show SQL in output window I see that the update hits database but for some reason it isn't committed to DB. Investigating further I see that I'm stuck with an open transaction meaning that the whole table is locked until my session scope is disposed (upon application exist). Currently I create a session scope when AR is initialized and leave it there. Wrapping the save statement inside a new TransactionScope "fixes" the problem but I find that kind of ugly. Manually disposing the current session scope and recreating it also works but that is quite ugly as well I think. It feels like using a "global" session scope like this isn't really the way to go but if I don't create a session scope before starting to throw queries at AR lazy loading breaks. Any hints on how to solve this? /Christian -- 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. -- 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.
