如何用NHibernate和Fluent NHibernate存储一个非截断的varchar(max)字符串 [英] How to store a non truncated varchar(max) string with NHibernate and Fluent NHibernate

查看:114
本文介绍了如何用NHibernate和Fluent NHibernate存储一个非截断的varchar(max)字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库模式有一个字符串作为varchar(max)。我已阅读其他问题有关设置长度超过4000或8000,以便它真的在映射中生成(n)varchar(max),但是当我在映射类中使用Length(10000)时,hbm文件实际上显示length =10000我保存超过10000个字符的实体,它实际上被截断为10000个字符。



我不希望有任何截断。



(使用NH3-alpha2和FNH干线)

解决方案

看起来这是一个老问题现在在NHibernate 3.x版本中重铺;您可以阅读有关变通办法此处


$ b 注意:我更新了过期的原贴。


My DB schema has a string as a varchar(max). I have read the other questions concerning setting Length to more than 4000 or 8000 so that it really generates a (n)varchar(max) in the mapping but when I use Length(10000) in my mapping class, the hbm file actually shows length="10000" and if I save an entity with more than 10000 chars, it is actually truncated to exactly 10000 chars.

I don't want any truncation.

(using NH3-alpha2 and FNH trunk)

解决方案

It would appear that this is an old problem which is now resurfacing in NHibernate 3.x builds; you can read about the workarounds here.

Note: I have updated the original link I posted as it was outdated.

这篇关于如何用NHibernate和Fluent NHibernate存储一个非截断的varchar(max)字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆