Repository模式没有LINQ或其他ORM? [英] Repository Pattern without LINQ or other ORM?

查看:126
本文介绍了Repository模式没有LINQ或其他ORM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

难道是有意义的使用Repository模式,而无需使用LINQ或一些其他的ORM?我写一个应用程序在MONO和使用MySQL,想用repositoy模式,但不会是能够处理的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。你所想的是抢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.

您可以看到在马丁·福勒网站一个非常高的水平说明

You can see a very high level description on Martin Fowlers site

这篇关于Repository模式没有LINQ或其他ORM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆