DataAnnotationsExtensions
DataAnnotationsExtensions copied to clipboard
Added NotNullOrZero Attribute + test + website modifications
This attribute is useful when Required is not enough because the value can't be zero either (Great for IDs)
Unfortunately this validator won't work client-side, so I'm not going to merge quite yet. Maybe you can create a client attribute adapter that uses both a "required" rule and a "non-zero" rule (currently a non-zero rule doesn't exist)? Also did you consider just doing something like [Required] along with [Min(1)]?
Yes, I currently use Min(1) but have to change the message everytime (want to avoid) and it's not semantic enough (want to avoid).
Will work on the client side and let you know.