I've modified NH Validator source:
- new Array extension method ElementsToString() - it concatenates
array elements.ToString()
- I've modified InvalidStateException constructor:
public InvalidStateException(InvalidValue[] invalidValues, String
className)
: base("validation failed for: " + className + " props:
"+invalidValues.ElementsToString())
{ .... }
So now my InvalidStateException messages are like:
NHibernate.Validator.Exceptions.InvalidStateException: validation
failed for: HsbcTransaction props: MasterCompany[may not be null]
PaymentId[length must be between 0 and 21] Description[may not be null
or empty]
On 10 Mar, 14:04, "Tomasz Modelski (IDev)" <[email protected]>
wrote:
> Hi.
>
> I've started to using NH Validator, and I' quite happy with it.
> However, there is one small problem.
>
> Without validator, some of NH / Ado exception where more meaningful,
> ex:
> NHibernate.PropertyValueException: not-null property ...
> entity.PropertyName
>
> So, looking at exception message I can quickly figure what's wrong.
>
> With NH Validator I've got InvalidStateException. I know I can extract
> errors via GetInvalidValues(..).
> But is it possible to have invalid property names in
> InvalidStateException message text ?
>
> Something like:
> ...InvalidStateException: validation failed for: HsbcTransaction,
> invalid properties: ..., .... , .... .
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.