Data Annotation Validation

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
Posts: 3
Joined: Thu 03 Dec 2015 05:11

Data Annotation Validation

Post by haveben » Thu 03 Dec 2015 05:26

I am new to the product and love it so far. My team has been loyal to Telerik until they screwed us dropping their designer for their ORM, so we are dropping them. I bought ED to test it out as a replacement. I see that I can add Metadata validation for each of the properties, but don't see where I can add remote validation. I realize the model isn't smart enough to know the action or controller, but there is no where to put the values in manually which I can find. So, every time I rebuild the model, I have to remember which properties I have added remote validation to and enter it manually.

If this is currently not implemented, could you toss it in the pot for future enhancements? I just want to be able to add it manually in the EntityProperty validation section so I don't have to remember which and where to add my remote validations on every rebuild of the model.

Thanks a bunch!

Once I get the team on board with using entity developer as a replacement, I will next be working on getting them to invest in dotConnect for Oracle as there are so many things I hate about using the default providers.

Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Data Annotation Validation

Post by MariiaI » Thu 03 Dec 2015 13:41

To set validation rules for entity properties, please open your model, in the Model Explorer (the Model Explorer can be opened by selecting Model Explorer from the Entity Developer submenu of the Tools menu) select Properties from the context menu of the used template (e.g. DbContext) and set the Validation Framework property, for example, to Data Annotations.
After you have made these changes, select a particular class property on a diagram (or in Model Explorer) and initialize the needed attributes in the Validation section in the Properties window.

If you want to add attribute that is not available in the Validation section of the Properties window, perform the following steps:
- select the necessary entity property;
- right-click it and select Attributes;
- click 'Yes' in opened dialog box;
- in the opened 'Model Settings' window click "Add..." and find and select 'System.ComponentModel.DataAnnotations';
- you will see the list of available attributes, please select the necessary one, e.g. 'System.ComponentModel.DataAnnotations.DisplayAttribute';
- select DisplayAttribute and move it to the Selected Attributes;
- in Constructor Parameters set properties (e.g., the ShortName property and others).

Save the model to regenerate the code (the code will be regenerated with all necessary attributes).

Please refer to the corresponding topic in the Entity Developer documentation: ... eloper.chm > Basic Workflows-> Code Generation-> Entity Property Validation ... eloper.chm > Basic Workflows-> Code Generation-> Attributes

If it is not what you mean, please describe your scenario in more details, with the exact steps, etc.

Post Reply