2

我一直在研究 martin fowler 在存储库模式部分的企业架构模式中简要描述的规范模式,以及 Web 上的几个示例。但是,几乎所有示例/描述都是通过使用 ORM 和 IsSatisfiedBy 等方法创建的,这些方法由规范对象执行(并且可能由 ORM 转换为 SQL)。

我可以看到您如何调整它以使用 SQL,但由于普遍缺乏 SQL 示例,我想知道人们是否正在将此模式与 SQL 数据访问层和存储库模式一起使用,以及他们的经验/方法如果有的话,或者任何可能更适合该任务的替代方案(如果有的话)。

4

1 回答 1

0

I believe that LINQ effectively implements the need to the specification pattern (I believe that this also ties into you request to work with SQL).

I suspect there are also APIs to spit out SQL without LINQ parse trees.

So, Entity Framework or LINQ to SQL would be worth looking into.

I hope this answers your question.

于 2011-02-23T22:55:44.110 回答