Hi Mike;
I'm assuming that you want to get the MaxValue of the StringLengthVerifierAttribute. If so, we can create a function that can be passed any DevForce entity and its property, and using its type and property name, we can using Reflections to get its MaxValue of the StringLengthVerifierAttribute. Please see code samples below.
public void GetMaxStringLengthSample() {
var maxStringLength = GetMaxStringLengthAttribute(typeof(Customer),
Customer.PropertyMetadata.CompanyName.Name);
Assert.IsTrue(maxStringLength == 40, "This should not fail");
}
public int GetMaxStringLengthAttribute(Type entityType, String propertyName) {
var propertyInfo = entityType.GetProperty(propertyName);
var attributes = (StringLengthVerifierAttribute)propertyInfo
.GetCustomAttributes(typeof(StringLengthVerifierAttribute), false).First();
return attributes.MaxValue;
}