title: Unit of Work pattern implementation
body: <p>I am creating an application with ASP.NET MVC and Entity framework code first. I am using repository and unit of work pattern with influence of from following link.</p>
  
  <p><a href="http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application" rel="noreferrer">http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application</a></p>
  
  <p>Here I have question about the implementation of Unit Of Work in that link unit of work is implemented via directly writing entities in class itself like.</p>
  
  <pre><code>public class UnitOfWork : IDisposable
  {
      private SchoolContext context = new SchoolContext();
      private GenericRepository&lt;Department&gt; departmentRepository;
  
      public GenericRepository&lt;Department&gt; DepartmentRepository
      {
          get
          {
  
              if (this.departmentRepository == null)
              {
                  this.departmentRepository = new GenericRepository&lt;Department&gt;(context);
              }
              return departmentRepository;
          }
      }
  
  }
  </code></pre>
  
  <p>Do you think that implementation is good enough because every time I add/remove entities I need to change my Unit of work class. I believe that Unit of work should not be dependent on entities. Because in my application based on Client feedback we are going to frequently add/remove entities.</p>
  
  <p>I may sound stupid but let me know your views on that.</p>