From the Kobe documentation:
The Repository pattern is applied to mediate access to the data store through a Repository provider.
A system with a complex domain model often benefits from a layer, such as the one provided by Data Mapper (165), that isolates domain objects from details of the database access code. In such systems it can be worthwhile to build another layer of abstraction over the mapping layer where query construction code is concentrated. This becomes more important when there are a large number of domain classes or heavy querying. In these cases particularly, adding this layer helps minimize duplicate query logic.
I think that Repository is a fad, which is why I don’t use it much anymore myself, and looking at the usage semantics of the “repositories” in Kobe, they certainly don’t fit the bill.
Repositories are here to encapsulate query logic, that is not the case with Kobe. Here is a partial view of some of the repositories that it have:
In general, looking at the any of the repositories in detail, I really want to cry. I mean, just take a look:
More to the point, let us look at GroupRepository.AcceptGroupInvite (I removed all the copy & paste crap to concentrate on the actual code):
GroupInvite groupInvite = _context.GroupInviteSet .Where(gi => gi.GroupInviteId == groupInviteId) .FirstOrDefault(); if (groupInvite == null) throw new DataException("Invalid Invite Id", null); groupInvite.InvitationStatuses = _context.InvitationStatusSet .Where(s => s.InvitationStatusName == "Accepted") .FirstOrDefault(); ; _context.SaveChanges(true);
There are so many things wrong with this approach that I don’t even know where to start.
You can see how the architects or developers resented having to use an ORM. If they couldn’t have stored procedures in the database, then by Jove and his keyboard, they will write stored procedures in code.
Kobe uses Entity Framework for data access, and they treat it as if it was a dataset. As an OR/M aficionado, I am insolated. This shows complete lack of understanding how Entity Framework work, doing a lot more work than you should, brute force & big hammer approach.
From an architectural perspective, most of what Kobe is doing is calling down to the repository to perform the data access details. Business logic, such as there is, is spread between the data access, the controllers and the service layer, in such a way that make is very hard to have a good idea about what is actually happening in the application.
Data access details are quite pervasive throughout the application, and the whole feeling of the application is of a circa 2001 sample app using stored procedures and hand rolled data access layers.