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

Consider adding Validate/ValidateAsync method overloads that use [CallerMemberName] #7

Closed
nathan-alden-sr opened this issue Jul 2, 2016 · 2 comments
Assignees

Comments

@nathan-alden-sr
Copy link

nathan-alden-sr commented Jul 2, 2016

Consider adding a ValidationHelper.Validate([CallerMemberName] string propertyName) overload to help avoid the need for a delegate.

This, within a Name property's getter:

_validationHelper.Validate(() => Name);
_validationHelper.ValidateAsync(() => Name);

becomes this:

_validationHelper.Validate();
_validationHelper.ValidateAsync();
@nathan-alden-sr nathan-alden-sr changed the title Consider adding a Validate method overload with [CallerMemberName] Consider adding Validate/ValidateAsync method overloads that use [CallerMemberName] Jul 2, 2016
@pglazkov pglazkov self-assigned this Jul 28, 2016
@pglazkov
Copy link
Owner

Introduced ValidateCaller/ValidateCallerAsync methods. Decided to go with different method names because adding [CallerMemberName] to existing methods Validate/ValidateAsync methods would cause the "Explicit argument passed to parameter with caller info attribute" warning whenever the Validate is called with explicit property name (e.g. somewhere outside of a property setter).

@nathan-alden-sr
Copy link
Author

nathan-alden-sr commented Aug 7, 2016

Thanks! This will be a good improvement to a good library. 👍

Any idea when this might be available on NuGet?

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

2 participants