예제 #1
0
 public void CreateDatabase()
 {
     if (CreateDatabaseInUnitOfWork)
     {
         if (!Nails.Configuration.ConnectionBoundUnitOfWork)
         {
             PersistenceContext.OpenSession();
         }
         try
         {
             WorkContextProvider.CurrentContext.RunUnitOfWork(DoCreateDatabase, new UnitOfWorkInfo(false));
         }
         finally
         {
             if (!Nails.Configuration.ConnectionBoundUnitOfWork)
             {
                 PersistenceContext.CloseSession();
             }
         }
     }
     else
     {
         DoCreateDatabase();
     }
 }
예제 #2
0
 /// <summary>
 ///   Disposes this Unit of work, and frees the Transactional Context by closing the connection.
 /// </summary>
 public void Dispose()
 {
     if (connectionBoundUnitOfWork)
     {
         persistenceContext.CloseSession();
     }
 }