问题描述
在不使用 LINQ 或其他 ORM 的情况下使用存储库模式是否有意义?我正在用 MONO 编写一个应用程序并使用 MySQL,正在考虑使用存储库模式,但无法处理 IQueryable.我正在考虑在存储库上公开更多方法,以明确过滤将在数据库端通过存储库调用发生.如果这是对设计或任何其他设计理念的有效使用,有什么建议吗?
Does it makes sense to use the Repository pattern without the use of LINQ or some other ORM? I am writing an application in MONO and using MySQL, was thinking of using the repositoy pattern but not going to be able to deal with IQueryable. I was thinking of just exposing more methods on the repository to make it obvious that filtering was going to happen on the db side with the repository call. Any suggestions if that is a valid use of the design or any other design ideas instead?
推荐答案
Repository 与 IQueryable 完全无关.您正在考虑的是 Rob Conory .net 3.5 采用存储库模式,这实际上更像是一种数据代理模式.
Repository has nothing at all to do with IQueryable. What you are thinking of is the Rob Conory .net 3.5 take on the repository pattern, which is actually more of a data broker pattern.
存储库负责返回对象,并处理数据访问,以便您的应用程序的其余部分可以保持对它的无知.
A repository is responsible for returning objects, and deals with data access so that the rest of your application can remain ignorant of it.
您可以在 Martin Fowlers 网站上看到非常高级别的描述
You can see a very high level description on Martin Fowlers site
这篇关于没有 LINQ 或其他 ORM 的存储库模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!