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
|
I'm getting an exception thrown when applying a range validator to an Int64 field. Steps to reproduce:
The exception I get is an ArgumentException "Object must be of type Int64." at System.Int64.CompareTo(Object value)
|
|
|
The problem appears to be the behavior of Int64.CompareTo - it throws up (as above) when the object being compared to is not an Int64. In your definition for the range validator the low end number is getting implicitely cast to an Int32 which is what then causes it to throw up. [ValidateRange(10000001, 9999999999)] You have a couple of options for a workaround here. If you have set up your entity by hand, change your ValidateRange declaration to this: [ValidateRange((Int64)10000001, 9999999999)] or if you are using the generator, set that particular field to be excuded from generation, then set up a partial class and manually recreate the field and property definitions and apply the validation as above. We will investigate if we can improve the way this works (we might be able to use a generically type IComparible for instance), so I have added a work item for this.
Jeremy |
|