In SL5 I have a DataForm that shows data from a DomainService.metadata generated from an Entity Model.
I'm using DataAnnotation.ValidationAttribues such as Required, StringLength, etc, to adorn the data properties in the DomainService.metadata.
These validation attributes work well, once I compile and run, the validations are present in the DataForm.
But I can't get the EnumDataType attribute to work in the DataForm, it's as if it wasn't there:
public partial class Student {
internal sealed class StudentMetadata {
public enum MyEnum {
One = 1,
Two = 2
}
private StudentMetadata() {
}
[EnumDataType(typeof(MyEnum), ErrorMessage = "Type 1 or 2")]
public Nullable<int> Other { get; set; }
[Required]
public int Age { get; set; }
For example, in the DataForm the field Age can't be left empty, but if I type 4 in the TypeOfRoom field, the error message doesn't show.
I know that I could use a ComboBox or something else, but I'm trying to learn the usage of the EnumDataType validation attribute.