MVC Compare email if confirm field is not empty
<p>Is there a way to trigger the <strong>Compare Data Annotation</strong> only if the field  <strong>is not empty</strong>?  If not, what is another way to do it?</p>

<p>This code below always trigger the Compare Data Annotation no matter if it has a value or not.</p>

<pre><code>[EmailAddress]
[Required]
[Display(Name = "Email Address")]
public string EmailAddress { get; set; }

[Display(Name = "Confirm Email Address")]
[Compare("EmailAddress", ErrorMessage = "The email addresses do not match.")]
public string ConfirmEmailAddress { get; set; }
</code></pre>