Using ServiceStack's OrmLite and decorating a Property with the following attribute, creates a column of type LONGTEXT, instead o TEXT as noted in the docs:
But it becomes LONGTEXT:
I tried setting the StringLenghtAttribute
to something else, 65535
, 70000
, Int32.MaxValue
etc, but it either interpretet it as a VARCHAR and gave me the Column length too big
or Row size too large
, or it became a LONGTEXT.
Question is: how can I force it to become "TEXT" (or any other text type in mysql)?
I could perhaps modify the MaxColumnDefinition
and set it to TEXT
but then I will never get LONGTEXT I assume.
UPDATE Setting the MaxColumnDefinition
to TEXT didnt change a thing
Can I decorate the class with an attribute, specifying the type somehow? Or is that too sql-version-specific?
Or perhaps I should override the GetColumnDefinition
and implement my own logic...
(Please note that this solution produces other problems that I will ask in a separate SO post)
After some more research, it was solved creating my own StringConverter, as can be seen below:
I also suggest setting the default StringLength to something smaller than the default 8000:
This way, the default
string
will bevarchar(255)
. If you want to make a specific string property something else, then set the attribute according to theMyStringConverter
: