How are Spring Data repositories actually implemented?

First of all, there’s no code generation going on, which means: no CGLib, no byte-code generation at all. The fundamental approach is that a JDK proxy instance is created programmatically using Spring’s ProxyFactory API to back the interface and a MethodInterceptor intercepts all calls to the instance and routes the method into the appropriate places: … Read more

Generic Repository With EF 4.1 what is the point

You are actually right. DbContext is an implementation of the unit of work pattern and IDbSet is an implementation of the repository pattern. Repositories are currently very popular and overused. Everybody use them just because there are dozens of articles about creating repository for entity framework but nobody actually describes challenges related to this decision. … Read more

What’s an Aggregate Root?

In the context of the repository pattern, aggregate roots are the only objects your client code loads from the repository. The repository encapsulates access to child objects – from a caller’s perspective it automatically loads them, either at the same time the root is loaded or when they’re actually needed (as with lazy loading). For … Read more