[转]NHibernate 对nvarchar(max)字段映射文件的处理
2012-12-03 14:58 sleepfulBird 阅读(492) 评论(0) 收藏 举报Migrating from NHibernate 2.1.x to NHibernate 3.0 could break some of your mapping of large strings. If you leave your property mappings just in the simple one-line form, NHiberate will truncate the inserted or updated data to 4000 characters. To solve this problem, make a small change to your mappings.
for nvarchar(max) use
<property name=”YourProperty” type=”StringClob”>
<column name=”DatabaseColumn” sql-type=”nvarchar(max)” />
</property>
for varchar(max) use
<property name=”YourProperty” type=”StringClob”>
<column name=”DatabaseColumn” sql-type=”varchar(max)” />
</property>
for text use
<property name=”YourProperty” type=”StringClob”>
<column name=”DatabaseColumn” sql-type=”text” />
</property>
for ntext use
<property name=”YourProperty” type=”StringClob”>
<column name=”DatabaseColumn” sql-type=”ntext” />
</property>
for xml use
<property name=”YourProperty” type=”StringClob”>
<column name=”DatabaseColumn” sql-type=”xml” />
</property>
浙公网安备 33010602011771号