This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
If I have a Non Nullable Int field, I am unable to allow a value of 0 because the validatePresenceRule checks to see if the field value is the default value for the type. Is there any way around this? It's very common to have a numeric value that is required and can also have a value of 0. |
|
|
No, the ValidatePresence rule checks that the value is not null and not a default value - e.g. 0 for an int. The simplest approach would probably be to override OnValidate for your entity and then implement a check there - see http://www.mindscapehq.com/documentation/lightspeed/Creating-Domain-Models/Validation for an example of how to do this. However if this is going to be something you need to implement many times across multiple entities then you should probably look at implementing this as a custom validation rule instead.
|
|