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
|
Is there any way to get the max length of a string field? It's quite useful to know. |
|
|
Not at present. String length is stored as a length validation and we dont currently expose any metadata about validations. Ill pop this on my list to try and add in soon though as this has been outstanding for a while with the metadata information we provide.
|
|
|
Hi Sean, Just a note to let you know that we have added in metadata about validations that are applied to each field within the model. You can enumerate the validations collection on a FieldInfo now to gather information about each validation. The ValidationInfo instances then have a reference to the validation name which you can use for comparison purposes, the .NET type of the validation class if you want to use that for comparison or for any further work within your code and then a dictionary of name/object pairs which contain the actual data associated with the validation instance. So for example for a length validation you will find a LengthValidationRule entry with Minimum and Maximum entres in the dictionary which hold integer values as set on the validation instance. This is now available in the nightly builds :)
|
|
|
Beauty - was just going to ask for this feature.... timing as ever is impeccable. |
|
|
Awesome. Thanks |
|
|
Happy to hear this feature has been added as well. Any chance you might be able to provide a terse code snippet as described in your example Jeremy? |
|
|
Sure here is a snippet from one of the tests for this - let me know if you need some more info on this :)
|
|