Ok. Perfect. I wish to thank again you (Markus) and Josè for your support.
--Alessandro On 20 Ott, 14:25, Markus Zywitza <[email protected]> wrote: > Exactly > > -Markus > > 2010/10/20 Alessandro C. <[email protected]>: > > > > > Markus, > > > All is clear but the use of the method Execute. > > > Suppose that I have a static helper class called PlanningProcess, this > > class has a method called GoAhed, inside this method there are > > controls, calculations and entity updates. > > Now, that I have a global session, I call from my form as follow (note > > that before saving or updating the entities I create a > > TransactionScope object): > > PlanningProcess.GoAhead(planning); > > > After using the conversation pattern I can use: > > conversation.Execute(() => PlanningProcess.GoAhed(planning)) > > > or > > using(new ConversationalScope(conversation)) > > { > > PlanningProcess.GoAhed(planning); > > } > > > and if I understand well I can remove the TransactionScope object > > because the conversation handles its own transaction > > is that true? > > > --Alessandro > > > On 19 Ott, 08:32, Markus Zywitza <[email protected]> wrote: > >> Hi Alessandro > > >> I've been in offline land for a couple of days... > > >> 2010/10/11 Alessandro C. <[email protected]>:> Following the > >> example of Markus > > >> >http://using.castleproject.org/display/AR/Using+the+Conversation+Pattern > > >> > I tried to change my application from single global session to a > >> > session per conversation but every time you need to hit the database > >> > you have to surround the operation with > >> > using (new ConversationalScope(conversation)) > >> > { > >> > } > > >> That's right and therefore you should only hit the database at defined > >> points in you code. But (and that's the benefit of Conversation) is > >> that the NH session lives as long as the conversation, so you can > >> access lazy loaded properties without using a scope and thus benefit > >> from binding mechanisms in the GUI framework. > > >> > more, if you have database access outside the form, for example a > >> > method on a helper class, you have to pass the conversation to the > >> > class if you want that method use the same conversation as the form. > > >> Can you share an example for this. I always call helpers from my form > >> objects, and use conversation.Execute(()=>helper.Help()) for this. > >> That way, the helper can call ActiveRecord methods within my > >> conversations session. > > >> > Is that correct or there is a way to share the conversation for the > >> > entire form thread? > > >> If you use SessionScope, you always share the session for the entire > >> thread (in rich clients), but this was the problem that made me > >> develop the conversation feature. If you have more than one form, all > >> run in the same thread, so you either have session per application > >> (boom) or you get ScopeMachineryExceptions (boom) when you have a > >> session per form. > > >> -Markus > > > -- > > 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 > > athttp://groups.google.com/group/castle-project-users?hl=en.- Nascondi > > testo citato > > - Mostra testo citato - -- 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.
