Hi,
I am using Data Annotations, and want to use specific Error Messages for properties. It seems that one can only specify general Validation type message in ED if one uses ED's validation mechanism ie "Value is Required". I did read that perhaps one could use a resource file, but that may be more for translation.
So it seems that if I do want more specific messages ie "Please specific First Name", then the only way to do this is via a buddy class where one specifies the annotations manually. If I am correct in my thinking then perhaps a nice improvement to ED would be the ability to specify messages in the properties grid, although there is a danger everything gets hidden away as a property. Perhaps better to do it in the Class Editor Window.
Thoughts?
Ed
Are the Validation Error Messages restricted when using ED Validation mechanism?
Re: Are the Validation Error Messages restricted when using ED Validation mechanism?
If you want to have a specific message for the separate property, set the value of property's Validate Required to False and implement the Data Annotation attribute for this property in the following way: add the reference to the assembly with the Data Annotation attributes via Model > Settings > Model > Attributes. After this, add the needed attribute to the model and a particular property.EdB wrote:So it seems that if I do want more specific messages ie "Please specific First Name", then the only way to do this is via a buddy class where one specifies the annotations manually.
Re: Are the Validation Error Messages restricted when using ED Validation mechanism?
Hi,
Thanks for this. This is great.
However can I suggest an improvement.Is it possible to have a more visible way of showing that validation attributes exist, something like a nesting under the property in the designer. I was looking a little while until I found "Attributes" in the property editor. Fine for the moment, but I wonder whether the Data Annotation validations could be pulled out more obviously.
Just thoughts.
Thanks for this. This is great.
However can I suggest an improvement.Is it possible to have a more visible way of showing that validation attributes exist, something like a nesting under the property in the designer. I was looking a little while until I found "Attributes" in the property editor. Fine for the moment, but I wonder whether the Data Annotation validations could be pulled out more obviously.
Just thoughts.
Re: Are the Validation Error Messages restricted when using ED Validation mechanism?
The Attributes property is currently available in Properties window (when HibernateProperty is selected) and in HibernateProperty's context menu.EdB wrote:Is it possible to have a more visible way of showing that validation attributes exist, something like a nesting under the property in the designer.
We will consider the possibility of implementing the Attributes property in Property Editor.EdB wrote:I was looking a little while until I found "Attributes" in the property editor.