开发者

Using the speicifcation pattern as a validation layer?

I have only seen the specification pattern used to retrieve data, but not to validate it. A colleague suggested I can use the specification pattern to “validate” an object so it does not become invalid when saving changes.

As an example, say we have a root Customer object that has a value for Address. We can track 开发者_JAVA百科the changes to the object and create a specification that can be sent to the unit of work to make sure the address is valid (Has a physical address, city, and state) before changes are saved.

Any thoughts about this?


Following is a good read regarding differences between a specification and a validaton http://lostechies.com/jimmybogard/2007/10/25/specifications-versus-validators/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜