Get Errorneous Data On Validation Failed

Jul 18, 2012 at 4:30 AM

Hi,

How can I be able to get dirty record(s) on which a validation fail(s)?

Coordinator
Jul 18, 2012 at 7:19 AM
Edited Jul 24, 2012 at 10:00 PM

Hi,

You cannot ask the ValidationReport 'GetAllObjectsWithErrorsOnThem'.

You can however ask the ValidationReport.HasError(o). Assuming you know which objects may have errors on them.

As a work around, you could create create your own IValidationReport, and redirect all calls to ValidationReport. In the AddError(...) method keep track of 'dirty records' and expose them through a public property.

Jul 19, 2012 at 5:18 AM
Edited Jul 19, 2012 at 6:07 AM

Hi,

Can you provide an example? It will be helpful.

How can lamdba expression will be used to get values from object variable?

Jul 20, 2012 at 3:50 AM
Edited Jul 20, 2012 at 3:51 AM

Hi,

I have figure-out the way to get dirty records. One can concat the value with message return. One need to add give line of code in GetErroMessages method in ValidationReport class and concat it with message.

var dirtyRecords = errorOnExpression.Expression.Expression.Compile().DynamicInvoke(value);