|Number of votes:||1|
Creating a meta field for a BF class of type string will by default result in a db column nvarchar(50). Changing the meta field type to LongText will result in the same.
After consulting the documentation (read decompiler) we learn that an attribute is also needed to actually change the db column type.
The MetaClass.CreateMetaField() function allows to input an AttributeCollection. Adding the attribute LongText with the value “true” to the collection will result in a db column of type ntext.
It's also possible to use the properties from my previous post about validators as attributes when creating meta fields. The meta class validator XML will then be extended with the validation information from the attributes and some of them will also be used when createing the db column.
For example using MaxLength for a string field type will change the default db column nvarchar(50) to nvarchar(x) as well as adding the MaxLength attribute to the validator XML.
Some validator properties have inconsistent naming in the meta field creation process in case you’re wondering why not all validator properties work. For example the validator property 'ValidationExpression' for File field types is represented in the meta field attributes as 'NameRegexPattern', and the validator property 'IsMultiValue' is called 'MultiValue' in the meta field attributes.
Happy coding ;)
Btw, I got questions on the image in my first blog post. It's from an old goat stable in the middle of nowhere in the northern parts of Sweden.
Being an e-commerce geek I think todays image is really fun. It was a delivery to me from a swedish office supplies company who didn't mind reusing boxes from their incoming deliveries (wonder where they've hidden those in the catalog, I looked but couldn't find it). Even for a company within the 'adult' segment, where one of the most common usp's is anonymous deliveries, it would be outrageous making a delivery like that!