Database :
mysql
Model Generation Template :
LinqConnect + Repository and Unit of Work + Data Annotations Metadata
Model :
Database-First Approach
what is the best way to define my validation ?
example validation:
compare one property to another, check if combine property already exist in my database or complex validation for my business rule
can you give some example?
Custom Validation
Re: Custom Validation
To set the validation rules for entity properties please open your model, in the Model Explorer select the Data Annotations Metadata template in the Templates node (the Model Explorer can be opened by selecting Model Explorer from the Entity Developer submenu of the Tools menu). Set its Validation property to True. If there is no special need to use this template, you can set the Validation Framework property to Data Annotations for the LinqConnect template and use two templates in your solution - LinqConnect and Repository and Unit of Work.
After you have made these changes, select a particular class property on a diagram (or in Model Explorer) and initialize the needed attributes from the Validation section in the Properties window. 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: Basic Workflows-> Code Generation-> Entity Property Validation.
If this information doesn't help, please specify the problems you are encountering in more details.
After you have made these changes, select a particular class property on a diagram (or in Model Explorer) and initialize the needed attributes from the Validation section in the Properties window. 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: Basic Workflows-> Code Generation-> Entity Property Validation.
If this information doesn't help, please specify the problems you are encountering in more details.
-
- Posts: 6
- Joined: Sun 23 Jun 2013 14:59
Re: Custom Validation
thanks, but it's only works for basic validation but how about for custom validation?
Is there a best practice way to use custom validation using entity developer?
if i using data annotation using inherited from ValidationAttribute http://msdn.microsoft.com/en-us/vs2010t ... opic2.aspx
where must i put the custom attributes for my custom validation, so when i regenerate the diagram it will not replace my entity property attributes Metadata...
if i can't use that approach, how about create custom template to generate service layer to validate my entity http://www.asp.net/mvc/tutorials/older- ... e-layer-cs
which approach do you suggest to work with entity developer?
Is there a best practice way to use custom validation using entity developer?
if i using data annotation using inherited from ValidationAttribute http://msdn.microsoft.com/en-us/vs2010t ... opic2.aspx
where must i put the custom attributes for my custom validation, so when i regenerate the diagram it will not replace my entity property attributes Metadata...
if i can't use that approach, how about create custom template to generate service layer to validate my entity http://www.asp.net/mvc/tutorials/older- ... e-layer-cs
which approach do you suggest to work with entity developer?
Re: Custom Validation
Please navigate to Model > Settings > Attributes > select the assembly with the needed attributes and make sure that the needed attributes are checked in the window below, press OK.
After this, the corresponding attributes should be available in the Attributes menu of the class property.
Does this help?
After this, the corresponding attributes should be available in the Attributes menu of the class property.
Does this help?
-
- Posts: 6
- Joined: Sun 23 Jun 2013 14:59
Re: Custom Validation
so you suggest first Approach .... !