SQL Server’s nvarchar(max) on Castle ActiveRecord
Programming, SQL May 6th, 2009
I’m using the new SQL Server 2005′s data type nvarchar(max) on a .Net project (ntext has been deprecated in this version) in conjuction with Castle ActiveRecord. For a complete integration (including schema creation), ActiveRecord property should looks like this:
[Property("description", ColumnType = "StringClob", SqlType = "nvarchar(MAX)")]
ColumnType = “StringClob” avoids text to be truncated if it gets too long. SqlType = “nvarchar(MAX)” forces the field to be created as that data type, otherwise, it will be created as nvarchar(255).
A more detailed explanation can be found here and here.
Tags: .Net, ActiveRecord, Castle, Hibernate, NHibernate, nvarchar, nvarchar(max), SQL Server
About