Hello everybody, first message to the list.
I'm writing my first application using NHibernate..
It's actually a wizard (winforms), and i'm trying to use it to learn
as much as i can..
Basically, the app loads a bunch of entities based on an input file,
then validates them against a given criteria, and modify some
properties on the valid ones.
The modification part must be completly atomic (all entities modified
in the same transaction, so no changes to the db are made if some
fail).
I'm using a singleton class to get sessions from the Session factory
based on some 'context' i define.
(and also looking for a better way to do it, but that's not the
important part of this e-mail)
In one of my 'upper layers' i call "StartContext", and "EndContext" to
delimitate a context in which the same Session will be given (to the
DAO's) by that singleton..
if i don't 'mark' the context like that a new session is created by it
for every operation.
My question is, would it be a good practice to use a single session
for the duration of the whole wizard dialog?
("StartContext" at the beginning of the dialog, "EndContext" when it finishes)
And, if i do this, would it be bad if i start and end multiple
transactions on it?.
Or should i make my sessions shorter?..(take into account that
validation and modification processes are minutes long)
I guess making my sessions shorter would mean that i should use second
level cahche to avoid reloading entities between validation and
modification?..
If someone could answer my questions, give me any insight or
suggestion, or yell to me for completly missing the point... it would
be welcome.
Many thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---