I have a few questions for you guys. If you don't mind taking the time
to answer, I'd appreciate it.

Compare the two samples below:

using (var session = sessionFactory.OpenSession())
using (var transaction = session.BeginTransaction())
{

// do something

}

using (var session = sessionFactory.OpenSession())
using (var transaction = session.BeginTransaction())
{

try
{
// do something
transaction.Commit();
}
catch
{
transaction.Rollback();
}

}

While I have been writing code similar to the second example, I have
seen many examples on the inet which were written like the first. Here
are my questions, In the context of the first example...

1) Will the transaction automatically attempt a commit, rolling back
on error, or will it simply dispose without changing anything?

2) If the transaction disposes without commiting (see question 1),
will the session flush instead, completely bypassing the transaction?

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