Page 1 of 1

Oracle Precision - Check generated in Model ORA-01438

Posted: Fri 11 Jul 2014 12:55
by software931
Sometimes we have the problem, that the values in model are larger than Oracle column definition.
Example: Oracle type is NUMBER(3,1), but given value is 10000.

If you try to store this to database, on oracle error is generated ORA-01438.

Is there a possibility, to generate automatically an exception, when a value greater then Oracle definition is set to the model value ?

P.S.:
Can this check be generated automatically, if this possibility exists, or must I adapt this manually column by column?

Re: Oracle Precision - Check generated in Model ORA-01438

Posted: Tue 15 Jul 2014 05:37
by MariiaI
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 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
...
Please refer to the corresponding topic in the Entity Developer documentation: Basic Workflows-> Code Generation-> Entity Property Validation.

If this information doesn't help or you have any further questions, feel free to contact us.