There is a long debate on whether it makes sense to wrap such advanced abstractions like the Entity Framework in repositories.
Historically, repositories were great. It was safe to have an extra layer of abstraction just to be able to switch between different data providers, plain old DataSet
s, files, linq, whatever.
However, many EF purists claim that EF is already an abstraction of the unit-of-work and repository with the data context being the unit of work and dbsets being repositories. They claim that the LINQ is the good enough abstraction of a query language and you don't need specific, restricted APIs.
Others say that this is not safe to assume that all possible providers are compatible in a sense that they provide consistent results for the same LINQ queries. Some providers could be limited and even refuse to evaluate specific queries. This - the people say - means that you still need an abstraction over EF so that you guarantee the same data contract for higher layers.
If someone decided to remove the repository layer from the example, this is possibly because of one of two reasons:
- someone realized that repositories just make the example more complicated and removed them for simplicity
- someone who is an EF purist would like to advocate the fact that "nothing shall stand above EF"
Personally, I like repositories and use them whenever possible.