Hello. I would like to ask if there is a method to truncate string fields. If for example you have a Person.LastName field that is defined as varchar(30) and you attempt to set the PersonEntity.LastName property to a longer value, then an ArgumentOutOfRange exception is thrown.
Most of the time that is what we need, but in some cases we may prefer to just store as much as we can, truncating the end. Here's what I currently do:
int maxlen = person.Fields[(int)PersonEntityFieldIndex.LastName].SourceColumnMaxLength;
person.LastName = (name.Length > maxlen) ? name.Substring(0, maxlen) : name;
It would be nice to have that an option on that field, and have the framework truncate the string on the developer's behalf.
Frans, what is your opinion on this? Is that something we can expect added in the future?