Hi,
I am working on a database first environment.
For validations we have been including constrains in database and defining some rules(constrains) on it.
However we just noticed that I am unable to fetch validation either as expression or range.
Is there anything I am missing of it really is so?
Range Validation in database first
Re: Range Validation in database first
If we understood you correctly, you are using validation on the server side and check the data being sent to the database table.
If you want to set such validation directly in the model, you can set the validation rules for entity properties. To do it, 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. Save the model to regenerate the code (the code will be regenerated with all necessary attributes).
For example:
Please refer to the corresponding topic in the Entity Developer documentation: http://www.devart.com/entitydeveloper/e ... eloper.chm > Basic Workflows-> Code generation-> Entity Property Validation.
If this information doesn't help, please send us a test model with the necessary DDL scripts and describe the steps we should follow to reproduce the behaviour.
If you want to set such validation directly in the model, you can set the validation rules for entity properties. To do it, 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. Save the model to regenerate the code (the code will be regenerated with all necessary attributes).
For example:
Code: Select all
[System.ComponentModel.DataAnnotations.Range(typeof(double), @"0", @"100")]
public virtual global::System.Nullable<double> VALUE
If this information doesn't help, please send us a test model with the necessary DDL scripts and describe the steps we should follow to reproduce the behaviour.