Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我只看到了用于检索数据的规范模式,但没有看到验证它。一位同事建议我可以使用规范模式来“验证”一个对象,这样在保存更改时它就不会变得无效。
例如,假设我们有一个具有 Address 值的根 Customer 对象。我们可以跟踪对象的更改并创建一个可以发送到工作单元的规范,以确保在保存更改之前地址是有效的(具有物理地址、城市和州)。
对此有什么想法吗?
以下是关于规范和验证之间差异的好读物 http://lostechies.com/jimmybogard/2007/10/25/specifications-versus-validators/