Could someone explain the benefits of using this pattern?
I mean isn’t EF a repository in a sense already? Can’t you just query the container and return those objects?
I see a lot of talk about POCO’s, AutoMapper, Dependency Injection, Service Layers, IoC. Am I just mixing a bunch of stuff together, or does it all relate?
Can someone explain this to me?
Also, how does this all fit together with MVC.net, ViewModels vs DataModels?
Thanks,
Sam
There is a bunch of random question’s there, so i’ll give a bunch of random answers:
IQueryable<T>Repositories, to materialize queries into concrete sequences (e.gICollection<T>).Elaboration Requested on #3
Example Controller WITHOUT Repository:
Problems with the above:
Example Controller WITH Repository (and IoC):
Why above is better:
MockProductRepositoryin the ctor, and work off that (which could be implemented as an in-memory list).