This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, I'm trying to get the list of validation errors from an instance of ValidationException. The main reason is that I would like to convert this to an equivalent ValidationFault that looks as follows:
So I'm wrote a factory method:
However, it seems that the list of validation errors are missing from ValidationException. Any chance you can add the errors collection to exception so I can correctly implement the CreateFault method? Thanks, Werner |
|
|
Beginning with the next nightly build, ValidationException will have an Entity property that indicates the entity in error. You can then use the Entity.Errors collection to get the validation errors. We did it this way because this provides greater flexibility for customers making programmatic use of the exception, e.g. it means you can capture the entity type and ID in the fault object if you later decide this is useful. Caveat: ValidationException is available for application code to reuse for non-LightSpeed validation errors. If the exception is raised by application code, the Entity property may not be set. You may therefore wish to guard against the possibility of ValidationException.Entity being null. (I mention this only as a 'belt and braces' thing; the Entity property will be set if the exception comes from LightSpeed, which is the normal case!) |
|
|
Thanks Ivan. |
|