/// <summary> /// This is an example of how to call or query components /// in a transactional scope. /// Please use as a template for similar tasks. /// </summary> private void TransactionalExample() { IStatelessSession theSession = null; try { // Name of the transaction for statistics only theSession = SessionPool.GetStatelessSession("TransactionalExample"); bool retry; do { theSession.BeginTransaction(); try { retry = false; // Do whatever you like using 'theSession' here... // eg. call a sequence of different components theSession.Transaction.Commit(); } catch (Exception e) { // HandleError will do a rollback and even a reconnect if necessary. retry = SessionPool.HandleError(e, ref theSession); if (!retry) { throw; } } }while (retry); } catch (Exception e) { logger.ErrorMethod("Exception occured. ", e); throw; } finally { if (theSession != null) { SessionPool.ReleaseSession(theSession); } } }