title: MVC3 App/Service Layer/Repository Layer/POCO Classes/EF4 - Questions!
body: <p>I am new to this whole design concept, and in reading for the last few weeks I have gathered a lot of information, but it seems scattered and conflicted. Terms are mixed, and I am just having a hard time wrapping my mind around this.</p>
  
  <p>The pattern I am using is like this and assume the flow as follows:</p>
  
  <p><strong>MVC Application</strong><br>
  The controller(s) process the request/response from the client for a given view. Inside the controllers action methods, they contact the services (Service Layer) and either request objects to build the view models, and sen the objects from the view models back.</p>
  
  <p><strong>View Models</strong><br>
  I am using strongly typed view models to and from the views.</p>
  
  <p>Are view models DTO's? Should they contain just simple properties like Name, AddressLine1, Address City, etc, or should they contain complex properties, multiple objects, etc.</p>
  
  <p>Is the validation in the view model. If so would it be validation like required fields, field length, etc. Then validation like user name already exists, or where you would need to interact with other objects in the service layer?</p>
  
  <p>Can the view models just contain the POCO classes returned from EF, or should I be using the AutoMapper?</p>
  
  <p>If using AutoMapper and DTO, are DTO's clones of the POCO classes?</p>
  
  <p>Would you map in the controller, view model, or in the service layer below?</p>
  
  <p><strong>Services</strong><br>
  To me, the service(s) are objects that contact the repository(s) to get POCO objects back from the EF. This is where all of my business logic is. Once the service hands an object back to a repository to be persisted to the EF, they are considered valid objects. Is this correct?</p>
  
  <p><strong>Repositories</strong><br>
  There is no business logic in them, they are just used to transport objects between the service(s) and the EF. Is this correct? I am implementing Interfaces here with generic repository. Then you could extend the generic repository for special needs?</p>
  
  <p><strong>Questions About Terminology</strong><br>
  1) Is a business object equal to a domain object? How much  logic should a domain object contain?</p>
  
  <p>2) Is the domain model the EF model? I am using the Model-First approach.</p>
  
  <p>3) Dependency Injection - Should I be using this? I understand how it works, just don't get the real benefit. I was playing with Ninject.</p>
  
  <p>I think the community would benefit from some sort of wiki that contained all the best practices with code samples. Is there something like that out there? A lot of the samples out there are very simple, and a lot of the Microsoft samples do not use this pattern even when claiming to.</p>
  
  <p>Thanks in advance to everyone who has and will help me with this.</p>
  
  <p>BTW - I think StackOverflow needs a little, "Buy Me A Beer" button next to the "Accept Answer" checkbox :)</p>