user2336660
user2336660

Reputation:

CompareAttribute always returns false

I have an auto-generated partial class for my model, I've extended it by creating a metadata class that decorates the fields/properties with metadata and attributes. I've added another partial class so I can give it a string property of email, but I dont want that stored in the db. I only want to use it to compare to the first entry for validation/comparision however the view always returns the error message stating that theyre not the same regardless of input.

[MetadataType(typeof(EmployeesMetadata))]
[DisplayColumn("FullName")]
public partial class Employees
{
    [CompareAttribute("EmailAddress")]
    public string ConfirmEmail { get; set; }
}
public class EmployeesMetadata
{
    public string EmailAddress { get; set; }
}

I'm not too sure why the compare is always false.

Upvotes: 0

Views: 145

Answers (0)

Related Questions