0

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");

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

but that configuration resets database everytime?
No that configuration allow db to update scheme only when your current scheme changed. And it means that even on scheme update you will not loose your data. It is absolutly constraint safty process, otherwise you can't update constraint limitation, as foreign key delete. But it has no need in 99% cases. Good luck :)
I will try it out after backup db :)
0

I solved it by deleting table manually, then .Length(4001); worked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.