I don't know that much about the inner parts of NH, but I've been
using AR and NH for a long time now, and since I'm mainly a web app
developer, I have a different POV.

I just create a TransactionScope in Begin_request and close it in
End_request or Page_error (or something like that).

Since you guys are discussing the benefits of using SessionScope vs
TransactionScope, I've been thinking if I took the right approach.

@Markus: Well, then what's the point of having a TransactionScope? If
SessionScope can handle it all?

Cheers,
Bernardo Heynemann
Developer @ ThoughtWorks UK

On Nov 3, 9:07 am, "Markus Zywitza" <[EMAIL PROTECTED]> wrote:
> ActiveRecord has always been more than an early "NH mapping attributes". One
> of the main features of AR was and is that it transparently manages
> sessions. I don't see no reason why we should now mandate TransactionScope
> for updates instead of managing the necessary transaction in the background
> whenever possible. I want AR to be a "simply works" solution based on
> NHibernate that still allows to dive in deep to use NHibernate to its
> fullest.
>
> -Markus
>
> 2008/11/3 karron <[EMAIL PROTECTED]>
>
>
>
>
>
> > SessionScope's autoflushing behavior bothered me before. I think it is
> > better that use trasactionscope explicitly to update data.  When we
> > want to update data, we must use transactionscope or ATM.
>
> > On Mon, Nov 3, 2008 at 3:04 AM, Craig Neuwirt <[EMAIL PROTECTED]> wrote:
>
> > > On Sun, Nov 2, 2008 at 12:54 PM, Markus Zywitza <
> > [EMAIL PROTECTED]>
> > > wrote:
>
> > >> Craig
>
> > >> I don't see why mandatory transactions in NH2 affect autoflush. With the
> > >> idiomatic NH double using-block, I have an autoflushing session as well.
> > >> Actually, SessionScope's autoflushing behaviour was broken after update
> > to
> > >> NH2 because the SessionScope session had no transaction. The performance
> > >> gain that results from non-autoflushing sessions is still available via
> > >> SessionScope(FlushAction.Never).
>
> > > I could be wrong, but if I am an AR user and I just want to retrieve
> > data, I
> > > would create a session scope and do my retrieval.  If I plan to perform
> > > updates I would create a TransactionScope, do my updates and commit.  I
> > was
> > > just suggesting we align the flush behavior with those scenarios to avoid
> > > having to remember to pass any parameters to the scopes.   What scenarios
> > > would this break on?
>
> > >> -Markus
>
> > >> 2008/11/2 Craig Neuwirt <[EMAIL PROTECTED]>
>
> > >>> -1
>
> > >>> Since NHibernate mandates a Transaction for all upates, I think the
> > >>> default for SessionScope should not be AutoFlush.  This also seems to
> > >>> suggest TransactionScope should remain FlushMode.Commit.  I think this
> > is
> > >>> the preferred approach since readonly operations will not be penalized
> > by
> > >>> NHibernate having to check dirty entities.
>
> > >>> On Sat, Nov 1, 2008 at 5:00 PM, Markus Zywitza <
> > [EMAIL PROTECTED]>
> > >>> wrote:
>
> > >>>> Hello
>
> > >>>> Earlier today I commited a patch to ActiveRecord that restored the
> > >>>> behaviour of SessionScope with respect to flushing. This change was
> > crucial
> > >>>> for a release because it prevents user from having to flush manually
> > when
> > >>>> using session scopes.
>
> > >>>> I also want to change TransactionScope to use FlushMode.Auto instead
> > of
> > >>>> FlushMode.Commit. This would be a breaking change, but it also
> > standardizes
> > >>>> flushing behaviour for all types of scopes. This helps especially in
> > DDD
> > >>>> since the transaction can be controlled outside of the model, with no
> > manual
> > >>>> flushes necessary. Additionally, there is no difference between code
> > running
> > >>>> in SessionScope and code running in a TransactionScope.
>
> > >>>> Other ideas I'd love to see in 1.0, but that could also come in 1.1:
>
> > >>>> StatelessSessionScope
> > >>>> Event support (configuration/Windsor)
> > >>>> Adding hbm.xml files for hybrid AR/NH use.
>
> > >>>> So what are your opinions on
>
> > >>>> changing TransactionScope and
> > >>>> releasing now or first completing NH2.0 support?
>
> > >>>> -Markus
>
> > --
> > Regards,
> > Karron- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" 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-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to