Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat specific issue does the repository pattern solve?
    text
    copied!<p><em>(Note: My question has very similar concerns as the person who asked <a href="https://stackoverflow.com/questions/11618809/few-things-about-repository-pattern-that-i-simply-dont-understand">this question</a> three months ago, but it was never answered.)</em></p> <p>I recently started working with MVC3 + Entity Framework and I keep reading that the best practice is to use the repository pattern to centralize access to the DAL. This is also accompanied with explanations that you want to keep the DAL separate from the domain and especially the view layer. But in the examples I've seen the repository is (or <em>appears to be</em>) simply returning DAL entities, i.e. in my case the repository would return EF entities.</p> <p>So my question is, what good is the repository if it only returns DAL entities? Doesn't this add a layer of complexity that doesn't eliminate the problem of passing DAL entities around between layers? If the repository pattern creates a "single point of entry into the DAL", how is that different from the context object? If the repository provides a mechanism to retrieve and persist DAL objects, how is that different from the context object?</p> <p>Also, I read in at least one place that the Unit of Work pattern centralizes repository access in order to manage the data context object(s), but I don't grok why this is important either.</p> <p>I'm 98.8% sure I'm missing something here, but from my readings I didn't see it. Of course I may just not be reading the right sources... :\</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload