canton7 / Stylet

A very lightweight but powerful ViewModel-First MVVM framework for WPF for .NET Framework and .NET Core, inspired by Caliburn.Micro.
MIT License
988 stars 143 forks source link

Clarify docs around `ValidatingModelBase.GetErrors(null)` #129

Open xlynx555 opened 4 years ago

xlynx555 commented 4 years ago

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.

canton7 commented 4 years ago

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

xlynx555 commented 4 years ago

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

canton7 commented 4 years ago

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

gmkado commented 3 years ago

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();
canton7 commented 3 years ago

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