Stylet icon indicating copy to clipboard operation
Stylet copied to clipboard

Clarify docs around `ValidatingModelBase.GetErrors(null)`

Open xlynx555 opened this issue 5 years ago • 5 comments

Hi, Method ValidatingModelBase.GetErrors(string propertyName) supposed to return entity-level errors if propertyName is null or string.empty (as it said in description): <param name="propertyName">The name of the property to retrieve validation errors for; or null or System.String.Empty, to retrieve entity-level errors.</param>

However, it's always returns null if no propertyName is set.

xlynx555 avatar May 06 '20 11:05 xlynx555

Do you have any entity-level errors? This sounds a lot like #119

canton7 avatar May 06 '20 11:05 canton7

Damn, I have same misleading understanding as in #119 Sorry, I should better look for closed issues before posting this...

xlynx555 avatar May 06 '20 11:05 xlynx555

No problem! That's probably a sign that I should update the docs. Leaving this open as a reminder

canton7 avatar May 06 '20 11:05 canton7

Hi @canton7 I had the same misunderstanding as @xlynx555, is there a way to get errors as a list of strings from ValidatingModelBase?

Currently I do this:

var errors = await Validator.ValidateAllPropertiesAsync();

gmkado avatar Dec 30 '20 06:12 gmkado

No. I'd accept a PR which added this.

canton7 avatar Dec 31 '20 12:12 canton7