This project is read-only.

Get Errorneous Data On Validation Failed

Jul 18, 2012 at 5:30 AM


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

Jul 18, 2012 at 8:19 AM
Edited Jul 24, 2012 at 11:00 PM


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 6:18 AM
Edited Jul 19, 2012 at 7:07 AM


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 4:50 AM
Edited Jul 20, 2012 at 4:51 AM


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);