Business rules validation in NHibernate Validator -
Is it possible to define a verification method (for businbess rule validation) which will be used by NHibernate.Validator? I mean something that exists in EntLib:
[HasSelfValidation ()] Public class SomeClass {// ... [SelfValidation ()) Public Virtual Zero DoValidate (Validation Results Results) { //...}}
Yes, it can be done - but you In order to communicate more information about what rules were violated in case of certification errors will disappear in a way.
NHibernate Validator offers only the ability to specify a text message, class name for my knowledge, and - Violation of property level verification properties - Name of infringement property.
If your attribute HasSelfValidationAttribute apply IRuleArgs a IValidator code> (or IInitializableValidator ), There is no other way to do it, but a simple string message and the name of the class, which is probably too low if your demand is to validate the "real business rules", it is formed.
The NHibernate validator is great for simple attested scotched properties of a class, but when it requires less complicated verification, it comes less.
Comments
Post a Comment