什么是规约模式 规约模式允许我们将一小块领域知识封装到一个单元中,即规约,然后可以在code base中对其进行复用. 它可以用来解决在查询中泛滥着GetBySomething方法的问题,以及对查询条件的组合和复用. 举个例子 public class Movie : Entity { public string Name { get; } public DateTime ReleaseDate { get; } public MpaaRating MpaaRating { get; } pub…
最近一直在看DDD开发 规约似乎用得很普遍. 但是还是理解不了.所以记录下学习的进度.- 规约(Specification)模式 目的:查询语句和查询条件的分离 写了一个关于规约的模拟小程序 class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) { OrderInfo o = new OrderInfo() { ID = i + 1, OrderTime = DateTime.Now, Po…
一段时间没有在github 上浏览ABP项目,几天前看到ABP新增规约模式,开始了解并学习文档 记录一下 Introduction 介绍 Specification pattern is a particular software design pattern, whereby business rules can be recombined by chaining the business rules together using boolean logic (Wikipedia).规约模…