Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use the <a href="http://www.martinfowler.com/eaaCatalog/unitOfWork.html" rel="nofollow noreferrer">Unit of Work pattern</a> to do your transaction management. The major benefit of the unit of work pattern is that you can keep your transaction strategy on one place, or a few places when you have multiple strategies. The most simple unit of work interface could be:</p> <pre><code>public interface IUnitOfWork { void Start(); void Commit(); void RollBack(); } </code></pre> <p>You can create various UnitOfWork implementations for different ORMs or for stored procedures or on hard-coded sql. You can start the transaction in the begin of the request. The transaction can be disposed on the end of the request. Before the disposal, you can wrap the commit in a try-catch block with rollback in the catch. </p> <pre><code>try { unitOfWork.Commit(); } catch { unitOfWork.RollBack(); throw; } </code></pre> <p>There transaction start strategies are:</p> <ul> <li>Per request: one transaction is used on the whole request, this is the best way in most cases.</li> <li>Multiple times per request: A transaction per method.</li> <li>Per Conversation: You can create a transaction around several requests of a shopping cart checkout process.</li> </ul> <p>You can manage your transaction with:</p> <ul> <li>attributes</li> <li>application_begin and endrequest method in global.asax</li> <li>httpmodule</li> </ul> <p>When using StructureMap, you can use Hybrid caching as InstanceScope in the unit of work configuration. You can inject the unit of work into repositories with StructureMap.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload