Reputation: 2975
I have recently updated from NH2.1 to the latest trunk build. I also upgraded to the latest source code of Fluent NHibernate.
A new issue has been introduced which manifests as the following exception :
System.Data.SqlClient.SqlException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3 ("@p0"): Data type 0xE7 has an invalid data length or metadata length.
My fluent mappings produce the following hbm xml :
<property name="FirstName" type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="FirstName" length="4001" />
</property>
The problem goes away if I use 'ntext' to produce the following mapping :
<property name="FirstName" type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="FirstName" sql-type="NTEXT" />
</property>
To be honest I am unsure who/what is responsible for the issue. My instinct suggests that it is NHibernate itself, and I was able to isolate the issue to that particular property mapping (in actuality there are multiple max strings in the entity being mapped).
For further complexity, the problem does not show when using Sqlite, so my guess is the issue may be buried in the dialect.
(I want to establish what is causing the issue before I post to the relevant user group)
Upvotes: 2
Views: 1470
Reputation: 2975
The solution is not really an answer.... but works anyway. To fix the issue I changed the length in the mapping to 10000. Now it all works.
So my mappings would now look like :
Map(x => x.FirstName).Length(10000);
Go figure.
It would be great is someone could shed some light on this peculiarity.
Upvotes: 2
Reputation: 49251
In your mapping, set the string property length to 4001 or higher:
Map(x => x.FirstName).Length(4001);
Upvotes: 1