shenku
shenku

Reputation: 12448

FluenNnhibernate - Error dehydrating property value

I have seen a lot of these errors on stack overflow, and followed the answers closely but I genuinly can't see the same issues in my code.

I get the following exception when trying to commit my changes:

{"Error dehydrating property value for MyModel.Field"}

With and inner exception of:

{"The length of the string value exceeds the length configured in the mapping/parameter."}

I have a mapping override for the model that looks like this:

 mapping.Map(x => x.Field).Length(10000); 

And the column in the database is nvarchar(MAX).

If I check the value of the field in notepad++ it says the length is 5355, and the stack trace is not fiving up any more information. :(

I really think I have covered all the angles, why am I still getting this error?

Upvotes: 1

Views: 4904

Answers (1)

Simon Whitehead
Simon Whitehead

Reputation: 65077

This is a known issue in regards to NHibernate's handling of nvarchar(max).

I remember seeing this last year: https://stackoverflow.com/a/12711809/1517578

That SO answer has links to explanations and workarounds for Fluent NHibernate.

Upvotes: 2

Related Questions