Comments on: Generic Repository Pattern in Entity Framework https://codingsight.com/entity-framework-antipattern-repository/ Blog for SQL Server DBAs and Developers Mon, 18 Oct 2021 14:49:08 +0000 hourly 1 https://wordpress.org/?v=6.5.2 By: Victor Cejudo https://codingsight.com/entity-framework-antipattern-repository/#comment-103 Wed, 20 Sep 2017 12:24:00 +0000 http://codingsight.com/?p=2164#comment-103 And then, if you want to stop using Entity Framework because some mapping problems that NHibernate doesn’t have, or because of a specific aspect of an inherited database that you can’t do with an ORM, you need to provide all the functionality of IQueryable.

Wouldn’t it be simpler just make a method in the interface called FindByFields that gets a data structure and make that combination of queries in the implementation? What if Entity Framework shows a poor performance and I want to call a stored procedure instead?

The specification pattern is for business logic, not to expose database aspects to the business.

I do want to get collections as the result of the repository, not IQueryable because I want the unit of work to be completely closed and disposed when the repository returns, not to have potential state problems with the result of the methods.
The caller should not be aware of that.

]]>
By: wałdis iljuczonok https://codingsight.com/entity-framework-antipattern-repository/#comment-102 Fri, 15 Sep 2017 07:47:00 +0000 http://codingsight.com/?p=2164#comment-102 good read, however it all looks a lot of ceremony (which I guess we cannot avoid). have you ever witnessed underlying database engine switch in projects? heard it many times, done also abstractions in repositories back in time, but never ever had real example when we needed to switch databases..

]]>