I am trying to insert some very long text into a string prop - it worked perfectly fine with LinqToSql, now I have switched over to NHibernate and want to save the same enti
I hit a similar problem but using a CustomType
(derived from IUserType
). It turns out to be easier to fix than without a custom type. All you need to do is define SqlTypes to explicitly return the longer string length type you want.
public SqlType[] SqlTypes
{
get
{
// Explicitly specify the string max length
return new SqlType[] { SqlTypeFactory.GetString(Int32.MaxValue / 2) };
}
}
This solved the problem for us quite nicely.