Reputation: 1459
I have a problem with Entity Framework, it's truncating a string value while saving into database
I have database column Description nvarchar(max)
in SQL Server 2014, and a property like this on my model class:
public string Description { get; set; }
I used this code to insert into database
db.EnitityName.Add(object);
db.SaveChanges();
Normally it works to save records, there is no problem, but when string exceeds more than 40k characters in Description
property, it's saved value is truncated to the last characters from 40k to above.
E.g we have a 50k characters string, it saves only the first 40k characters and truncates the last 10k characters.
Is there something I did wrong, or does Entity Framework have a limitation on the string length, or database limitation in nvarchar(max)?
Please help me, I appreciate your valuable time in advance.
Thanks
Upvotes: 2
Views: 2555
Reputation: 576
I had the same issue, but it turned out to be SQL Server Management Studio truncating the data, not Entity Framework (as Scott Chamberlain said in the comments). Change it by going to Query->Query Options):
Upvotes: 10