title: The unit of work pattern within a asp.net mvc application
body: <p>I have been looking at this excellant <a href="http://www.nhforge.org/wikis/patternsandpractices/nhibernate-and-the-unit-of-work-pattern.aspx" rel="nofollow noreferrer">blog</a> titled "NHibernate and the Unit of Work Pattern" and have a question regarding the best place to use UnitOfWork.Start in a asp.net mvc project.</p>
  
  <p>My SLN is broken down into the following projects:-</p>
  
  <pre><code> MVC project
   Repository
   NHibernateUnitOfWork
  </code></pre>
  
  <p>I have an interface:-</p>
  
  <pre><code> public interface INameRepository
   ...
         IList&lt;Name&gt; GetByOrigin(int OriginId)
   ...
  </code></pre>
  
  <p>I have a concrete implementation</p>
  
  <pre><code>     public class NameRepository : INameRepository
       ...
            public  IList&lt;Name&gt; GetByOrigin(int OriginId) {
                  using (UnitOfWork.Start()) {
                       var query = session.Linq&lt;...
                       return query;
                  }
            }
       ...
  </code></pre>
  
  <p>My question is do I wrap all my methods inside all my repositories with  using(UnitOfWork.Start()) or is there a better approach?</p>
  
  <p>I am using nHibernate, asp.net mvc.</p>