You can change the behaviour by implementing your own IThreadScopeInfo type and registering it. The scope info is responsible for storing and serving the current scope.
Since AR needs the stack-metaphor to look up the current scope for an operation you must provide means to have multiple stacks in your scope info and select them by calling a static method from your form that sets the current business transaction for a given thread. -Markus 2009/9/14 Dan Malcolm <[email protected]> > > Hi > > I am making a change to an existing ActiveRecord-based winforms > application. This involves allowing the user to have several screens > open at once, each of which manages a separate "business > conversation". Each screen instance needs its own SessionScope. > > On a different NHibernate project, I've implemented something similar > to Conversation Per Business Transaction (http:// > fabiomaulo.blogspot.com/2008/12/conversation-per-business- > transaction.html). In this case we have several long running sessions > that are created, paused, resumed, committed and disposed during a > conversation. > > This doesn't seem to be supported by AR SessionScopes. Example > scenario: > > 1. User views a summary of customers > 2. User selects customer Dave to edit, which opens a new customer > details screen (screen 1. A new SessionScope is created for this > conversation > 3. User selects customer Mike to edit, which opens a second customer > details screen (screen 2). A separate SessionScope is created for this > conversation > 4. User activates details screen 1 and closes it. This disposes the > SessionScope, resulting in a "Tried to unregister a scope that is not > the active one" exception. > > As each screen were activated (focussed), the SessionScope it was > using would need to be "promoted" back to being the current scope > (e.g. accessible via SessionScope.Current). The stack-based > SessionScope management in ActiveRecord doesn't currently allow this. > > Have people come up against this problem before? > > Would it be suitable to change ActiveRecord to permit this scenario? > > I'm thinking that a new method SessionScope.Activate could be used to > promote an earlier SessionScope back to "current" position. A > corresponding ActivateRegisteredScope method in > AbstractThreadScopeInfo would clear and recreate the items in the > stack with the newly active SessionScope at the top. I haven't spent a > great deal of time in the AR code, so let me know if I'm missing some > important considerations here. > > Cheers. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
