Page 1 of 1

Are the Validation Error Messages restricted when using ED Validation mechanism?

Posted: Tue 12 Feb 2013 17:43
by EdB
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

Re: Are the Validation Error Messages restricted when using ED Validation mechanism?

Posted: Thu 14 Feb 2013 12:21
by Shalex
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.
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.

Re: Are the Validation Error Messages restricted when using ED Validation mechanism?

Posted: Mon 18 Feb 2013 13:47
by EdB
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.

Re: Are the Validation Error Messages restricted when using ED Validation mechanism?

Posted: Wed 20 Feb 2013 11:51
by Shalex
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.
The Attributes property is currently available in Properties window (when HibernateProperty is selected) and in HibernateProperty's context menu.
EdB wrote:I was looking a little while until I found "Attributes" in the property editor.
We will consider the possibility of implementing the Attributes property in Property Editor.