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

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
EdB
Posts: 91
Joined: Mon 15 Oct 2012 09:24

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

Post by EdB » Tue 12 Feb 2013 17:43

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

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Thu 14 Feb 2013 12:21

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.

EdB
Posts: 91
Joined: Mon 15 Oct 2012 09:24

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

Post by EdB » Mon 18 Feb 2013 13:47

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.

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Wed 20 Feb 2013 11:51

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.

Post Reply