开发者

Entity Validation in Sharp Architecture Repository

I have created a new 1.6 Sharp Architecture project.

I have marked my only Entity with HasUniqueDomainSignatureAttribute and one string property marked DomainSignatureAttribute.

I create 2 entities with the same DomainSignature and I'm able to save them both thous having dup开发者_运维百科licates.

Am I missing some configuration? As I was under the impression that this would work out of the box.


Before saving you should manually check entity for validness. I don't know how it is done now, but in previos versions each entitity had a property IsValid.


Well yes, the Validation method IsValid() is on the Entities.

But from the documentation I get the impression that if using NHibernate and NHibernate.Validators the repositories should validate the entities before Insert and Update. As in the documentation on nhforge.org

In SharpArch.Data.NHibernate.NHibernateSession following snippet is called each time Init() is used.

Entity Validation in Sharp Architecture Repository

Those things make me wonder why it doesn't work.

I could roll my own, but that seems like waste if it's already there.

Can anyone point me in the right direction? Also the SchemaExport util should use the validators when generating the scripts.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜