Using Reflector I think I have understood (and the previous post id
not correct):

The method CreateSession of the class ScopedConversation opens a
session and creates a transaction (this method is invoked the first
time you create a ConversationalScope object), the method Dispose (and
the method Restart) clears the session performing the commit or
rollback (se below).

private void CreateSession(ISessionFactory factory, IInterceptor
interceptor)
{
    ISession session = factory.OpenSession(interceptor);
    session.BeginTransaction();
    session.FlushMode = (this.flushMode ==
ConversationFlushMode.Automatic) ? FlushMode.Auto : ((this.flushMode
== ConversationFlushMode.OnClose) ? FlushMode.Commit :
FlushMode.Never);
    this.openedSessions.Add(factory, session);
}

I think that the class ScopedConversation should mantain the session
but the Transaction should be handled by the ConversationalScope
class.

The reason is that a windows form may remain open for a long time and
perform many tasks, it is not correct opening a transaction when the
form opens and committing the transaction when the form closes. It
would be better (from my point of view) that the creation of the
object ConversationalScope creates the transaction too, and the
dispose of the ConversationalScope object executes the commit or
rollback of the transaction.



On 26 Ott, 22:47, "Alessandro C." <[email protected]>
wrote:
> I thougth that disposing a ConversationalScope object does the commit
> of the transaction, but:
>
> using (new ConversationalScope(conversation))  // start transaction
> {
>
> scheduleProcess.DeleteScheduleItem(schedulerControl.SelectedAppointments[0]­);
>
> } // do not commit
>
> if I write conversation.Dispose();    perform commit
>
> or
>
> using (new ConversationalScope(conversation))  // start transaction
> {
>
> scheduleProcess.DeleteScheduleItem(schedulerControl.SelectedAppointments[0]­);
>      conversation.Restart();  // perform commit
>
> }
>
> I tried with all ConversationFlushMode option but nothing change.
>
> What is my mistake?
>
> --Alessandro

-- 
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.

Reply via email to