Bonjour tout le monde,
Je me posais une question à propos du mot clé using. Il replace un try catch normal.
Si jamais je fais
Va-t-il comprendre qu'il faut fermer la session et la transaction où va-t-il remonter l'exception avant.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 using (ISession sess = NHibernateHelper.GetSession()) using (ITransaction tx = sess.BeginTransaction()) { try { // do some operations tx.commit(); } catch (Exception ex) { tx.rollback(); throw (ex); } }
Merci
oolon
Partager