Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
     }
 }