title: MVC IValidatable method only executes after pre-defined attributes
body: <p>I have a model defined this way:</p>
  
  <pre><code>public class AdvisoryViewModel : IValidatableObject
  {
      [Display(Name = "Start Date")]
      [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true)]
      public DateTime? StartDate { get; set; }
  
      [Display(Name = "End Date")]
      [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true)]
      public DateTime? EndDate { get; set; }
  
      [Display(Name = "Instructions")]
      [Required(ErrorMessage = "Instructions are required")]
      [MaxLength(500, ErrorMessage = "Instructions cannot be longer than 500 characters.")]
      public string Instruction { get; set; }
  
      IEnumerable&lt;ValidationResult&gt; IValidatableObject.Validate(ValidationContext validationContext)
      {
          List&lt;ValidationResult&gt; results = new List&lt;ValidationResult&gt;();
          if (StartDate.HasValue &amp;&amp;
              EndDate.HasValue &amp;&amp;
              StartDate.Value &gt; EndDate.Value)
          {
              ValidationResult result = new ValidationResult("Start date must be after end date.");
              results.Add(result);
          }
          return results;
      }
  </code></pre>
  
  <p>And I am validating it as follows:</p>
  
  <pre><code>        var validationResults = new List&lt;ValidationResult&gt;();
  
          if (!Validator.TryValidateObject(advisoryViewModel, new ValidationContext(advisoryViewModel), validationResults,  true))
          {
              return Json(new { success = false, message = string.Join("; ", validationResults.Select(r =&gt; r.ErrorMessage)) });
          }
  </code></pre>
  
  <p>What happens on validation is it first only calls the "Required" attributes - for example, if the start date is later than end date AND the instructions are null, it returns with only the message that instructions cannot be null. Once they are not null, it returns the start/end date error message.</p>
  
  <p>Is there a way to have it do ALL of the validations up front rather than two attempts?</p>
  
  <p>Also, is there a way the start/end validation can be added to client side results?</p>