I tried this as well before posting and that did not work.
Since I now have a constructor that takes in a message, I have to provide a default constructor or MVC complains. So here's what I have:
UserValidation class:
RuleFor(u => u.Something).SetValidator(new Validation("test"));
ValueValidation class:
public ValueValidation (string message) { RuleFor (u => u.Value).NotEmpty(message); }
public ValueValidation () { RuleFor (u => u.Value).NotEmpty("blah"); }
Regardless of the fact that I set the message in the UserValidation class, it always goes to the default constructor and uses "blah" as my message...
Any reason why this is happening? Or do you have any ideas on how to solve this?
Let me know,
Thanks,
_sunny
Since I now have a constructor that takes in a message, I have to provide a default constructor or MVC complains. So here's what I have:
UserValidation class:
RuleFor(u => u.Something).SetValidator(new Validation("test"));
ValueValidation class:
public ValueValidation (string message) { RuleFor (u => u.Value).NotEmpty(message); }
public ValueValidation () { RuleFor (u => u.Value).NotEmpty("blah"); }
Regardless of the fact that I set the message in the UserValidation class, it always goes to the default constructor and uses "blah" as my message...
Any reason why this is happening? Or do you have any ideas on how to solve this?
Let me know,
Thanks,
_sunny