My understanding is that EF have no auto-flush at all, and that
EF.SaveChanges() will internally create a TransactionScope that it will
call Complete() on before returning. This will mean that the changes are
committed, UNLESS the call to EF.SaveChanges() is performed within an
already open ambient transaction, in which case you will still have to call
Complete() on that yourself, per the normal workings of TransactionScope.
Using EF.SaveChanges() without an ambient transaction would, as I
understand it¸ make you preceding reads happen in different transactions
from the write operation.

So I don't really see a difference in the number of calls. Note that you
normally don't have to call Flush(), because it will normally happen
automatically when committing.

/Oskar


2012/9/19 Mouhong Lin <[email protected]>

> But I think Flush is not 100% same as transaction.Commit(), right?
> In EF, Linq 2 SQL, Rave nDB etc, session.SaveChanges() equals to
> transaction.Commit() in NHibernate.
> I think it's more convenient to have a method like SaveChanges directly in
> the ISession interface.
> But NHibernate doesn't have such a method. So I'm wondering if there're
> some other design considerations or historical reason? Thanks
>
>
> On Friday, September 7, 2012 8:03:31 PM UTC+8, Oskar Berggren wrote:
>
>> There is. It is called ISession.Flush().
>>
>> /Oskar
>>
>>
>> 2012/9/7 Mouhong Lin <[email protected]>
>>
>>> Hi guys,
>>>
>>> I'm just wondering why NHibernate does not provide a "SaveChanges" or
>>> "CommitChanges" method in the ISession interface just like what
>>> EntityFramework, Linq to SQL and RavenDB does. Is there any historical
>>> reason?
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "nhusers" group.
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/nhusers/-/GjlsBIoYPa8J<https://groups.google.com/d/msg/nhusers/-/GjlsBIoYPa8J>
>>> .
>>>
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to nhusers+u...@**
>>> googlegroups.com.
>>>
>>> For more options, visit this group at http://groups.google.com/**
>>> group/nhusers?hl=en <http://groups.google.com/group/nhusers?hl=en>.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nhusers/-/Y329AERwhcsJ.
>
> 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/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.

Reply via email to