StringClob FTL
Found another Castle ActiveRecord/NHibernate gotcha today.
I had string columns being noisily truncated in my ActiveRecord types. Grr. I google and find a solution in the ActiveRecord FAQ: add a ColumnType="StringClob" to the property attribute.
[Property(ColumnType="StringClob")] public String Contents { get { return _contents; } set { _contents = value; } }
Silly me though, I expected that to actually work as advertised. It doesn’t.
When you use ActiveRecord to create your schema, it will create the above column as a NVARCHAR(255). OMGWTFBBQ?!
The solution is to add an SqlType = "NTEXT" to your attribute as well. Mmm, cryptic.
[Property(ColumnType = "StringClob", SqlType = "NTEXT")] public string Description { get; set; }
Please refer to the following for further discussion of the issue.
you’re using underscores now?
Posted on 08-Jul-08 at 1:47 pm | Permalink
Yeah that wasn’t my code, I pasted. Underscores also FTL.
Posted on 08-Jul-08 at 1:58 pm | Permalink
or you could use nvarchar(max) under SQL Server >= 2005
Posted on 04-Aug-08 at 2:31 am | Permalink