Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify docs around ValidatingModelBase.GetErrors(null) #129

Open
xlynx555 opened this issue May 6, 2020 · 5 comments
Open

Clarify docs around ValidatingModelBase.GetErrors(null) #129

xlynx555 opened this issue May 6, 2020 · 5 comments

Comments

@xlynx555
Copy link

xlynx555 commented May 6, 2020

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
Copy link
Owner

canton7 commented May 6, 2020

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

@xlynx555
Copy link
Author

xlynx555 commented May 6, 2020

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

@canton7
Copy link
Owner

canton7 commented May 6, 2020

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

@canton7 canton7 changed the title GetErrors doesn't return entity-level errors Clarify docs around ValidatingModelBase.GetErrors(null) May 6, 2020
@gmkado
Copy link

gmkado commented Dec 30, 2020

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
Copy link
Owner

canton7 commented Dec 31, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants