Hi,
How do I validate dates in Ed via Data Annotations?
Also is it possible to extend the number of validators?
Thanks
How do I add a Validation for Date to my Property?
Re: How do I add a Validation for Date to my Property?
Hi,
I have just revisited one of my old posts to do with the use of "Attributes" which looks great apart from the fact I cannot get it to work in the MVC3 application. Also should these validations trigger in the "Retrieve Data" Grid in ED, as they do not seem to be doing so. Again it would be neat if this were possible since one could test the complete functionality of the Entity before it gets code generated to a POCO.
Many thanks.
I have just revisited one of my old posts to do with the use of "Attributes" which looks great apart from the fact I cannot get it to work in the MVC3 application. Also should these validations trigger in the "Retrieve Data" Grid in ED, as they do not seem to be doing so. Again it would be neat if this were possible since one could test the complete functionality of the Entity before it gets code generated to a POCO.
Many thanks.
Re: How do I add a Validation for Date to my Property?
My generated code for the date validation. Should this work?
[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Date, ErrorMessage = @"Not a valid date")]
public virtual string DateOfBirth
{
get
{
return _DateOfBirth;
}
set
{
_DateOfBirth = value;
}
}
private string _DateOfBirth;
[System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType.Date, ErrorMessage = @"Not a valid date")]
public virtual string DateOfBirth
{
get
{
return _DateOfBirth;
}
set
{
_DateOfBirth = value;
}
}
private string _DateOfBirth;
Re: How do I add a Validation for Date to my Property?
The Required Validators are working, but this date does not. Is it to do with the fact that the property is a string?
Ideally I want to validate for a correct date and then store as a string.
Ideally I want to validate for a correct date and then store as a string.
Re: How do I add a Validation for Date to my Property?
Please specify the problem with code generation made by Entity Developer you have encountered (how it actually generates the attribute and how it should). If possible, send us a small test model to reproduce the issue in our environment.
Be aware that a new Data Annotation Metadata template, generating Data Annotation metadata classes and decorating classes and properties with data annotation attributes for validation, presentation and defining metadata, is added to the set of standard templates of Entity Developer starting from the 5.5 version.
Be aware that a new Data Annotation Metadata template, generating Data Annotation metadata classes and decorating classes and properties with data annotation attributes for validation, presentation and defining metadata, is added to the set of standard templates of Entity Developer starting from the 5.5 version.