nhibernate - 如何设置存储过程参数的长度

标签 nhibernate nhibernate-mapping

由于某些考虑,我使用存储过程在数据库中插入一个实体。
我的一些字段可能有超过 4000 个字符的长度,但是 NH 生成的查询声明了一些 nvarchar(4000) 变量来传递参数的值。
有没有办法设置存储过程参数的长度?
我的参数映射是这样的:

<query-param type="System.String" name="ArticleBody" />

当我在这个标签中设置长度属性时:
<query-param type="System.String" name="ArticleBody" length="20000" />

我收到此错误:
“'News360.Common.Singleton`1' 的类型初始值设定项抛出异常。”

任何帮助将不胜感激
感谢和问候

最佳答案

好吧<query-param>元素仅支持 typename属性。

真正的问题是您使用了错误的类型。事实上,我认为你也在声明你的类型是错误的。 type 属性期望值出现在 中找到的表的第一列中。 5.2.2.基本值类型 在 NHibernate 引用中。

所以,使用 StringClob而不是 string (而不是 System.String)。

干杯

关于nhibernate - 如何设置存储过程参数的长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8366986/

相关文章:

asp.net-mvc - NHibernate: "failed to lazily initialize...",DDD方法

nhibernate - 多对多关系 : How to decide where to place inverse=true with XML Mapping

NHibernate 3.2 - 现在所有属性都需要 "set"方法吗?

mysql - hibernate :更改表失败

nhibernate - 在NHibernate(Fluent)中,如何将引用对象的属性映射到父对象?

nhibernate - IIS7 + NHibernate : Illegal operation attempted on a registry key that has been marked for deletion

NHibernate Linq 提供程序问题

NHibernate Hi/Lo - id 中的间隙

nhibernate - 'index'和 'list-index'有什么区别

NHibernate Fluent 与属性