title: In a MVC tiered architecture a Repository class is part of the Business layer or not?
body: <p>suppose you have an MVC application with the <strong>Model</strong> represented by an Entity Framework (EF) that "gets" data from a database and the action methods of the <strong>Controller</strong> that implements all the business logic. The Controller gets data from the database through the EF.</p>
  
  <p>Imagine that now you create a <strong>Repository class</strong> that is placed between Controller and Model. This way you have:</p>
  
  <p>1) <strong>Controller</strong>: implements most of the business logic;</p>
  
  <p>2) A <strong>Repository class</strong>, responsible to implement simple business logic, provide data  to every <strong>Controller</strong> in the application through methods and get data from the EF;</p>
  
  <p>3) <strong>Model</strong>: EF classes that gets data from the database and provide them to the <strong>Repository class</strong>.</p>
  
  <p><em>Is the Repository class the business service layer or there is the need to add a business layer placed between controllers and repository?</em> In this latter situation we have:</p>
  
  <p>1) <strong>Controllers</strong>: implements just the request elaboration;</p>
  
  <p>2) <strong>Business layer</strong>: a set of classes responsible to implement most of the business logic and provide data to every <strong>Controller</strong> in the application through methods;</p>
  
  <p>3) A <strong>Repository class</strong>: gets data from the EF and expose methods to the <strong>Business layer</strong> for querying the database;</p>
  
  <p>4) <strong>Model</strong>: EF classes that "get" data from the database and provide them to the <strong>Repository class</strong>.</p>
  
  <p>I do not consider the View because it is not relevant. I hope somebody can make clear for me this distinction. Many thanks</p>
  
  <p>Cheers</p>
  
  <p>Francesco</p>