Search code examples
c#fluent-nhibernatefluent-nhibernate-mapping

Fluent nHibernate string length issue


I am trying to set the length for an nvarchar, but no success - it is still nvarchar(255).

I am getting this error; "String or binary data would be truncated.\r\nThe statement has been terminated."

Map(x => x.Text).CustomType("StringClob");
//.Length(4001);
//.CustomSqlType("varchar(max)");
//.Length(10000);
//.WithLengthOf(10000);
//.CustomType("varchar(MAX)");
//.CustomSqlType("ntext");

Solution

  • Try to use update scheme option in fluent configuration, not to face with such problem again.

    As you wrote, you get constraint limitation of ms sql.