pglazkov / MvvmValidation

Lightweight library that helps reduce boilerplate when implementing validation in XAML MVVM applications
MIT License
167 stars 31 forks source link

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

Closed nathan-alden-sr closed 8 years ago

nathan-alden-sr commented 8 years ago

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();
pglazkov commented 8 years ago

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 commented 8 years ago

Thanks! This will be a good improvement to a good library. :+1:

Any idea when this might be available on NuGet?