Repository Pattern without LINQ or other ORM?(没有 LINQ 或其他 ORM 的存储库模式?)
问题描述
在不使用 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 的存储库模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:没有 LINQ 或其他 ORM 的存储库模式?


基础教程推荐
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01