I'm using Entity Framework code-first and so I make liberal use of Data Annotations. I use the [Key]
annotation, which is from sealed class KeyAttribute
and noticed that it has no client-side validation as it inherits from the Attribute
class and not the ValidationAttribute
class.
Because the class is sealed
, I can't inherit from it. Is there another way to add validation through data annotation without simply making another attribute that mimics [Key]
?
(I'm attempting to avoid something like [Key, KeyValidation("There may only be one!")]
)