NHibernate的 - 更新一个表的触发器会导致一个错误 - 意外的行数:2;预计:1 [英] NHibernate - Updating a table with a trigger on it causes an error - Unexpected row count: 2; expected: 1
问题描述
当我的数据提供者尝试.SaveOrUpdate()a row我得到两个返回值(一个用于实际更新,另一个用于执行触发器)
原始返回值如下所示:
(1 row(s)affected)
(1行受影响)
< NHibernate然后抛出一个异常,如下所示:意外的行数:2;预期:1
我基本上看起来等价于SET NOCOUNT ON在会话中。
任何想法? 然后你可以在触发器的代码之前/之后,更新触发器以禁用/启用SET NOCOUNT?
SET NOCOUNT ON
- 触发器
SET NOCOUNT OFF
So I'm trying to update an object in my MS SQL 2005 database using NHibernate. Please keep in mind that this is a legacy database used in many live systems and I can't remove the triggers.
When my data provider tries to .SaveOrUpdate() a row I get two returns (one for the actual update, and one when the trigger executes)
The raw return looks like this:
(1 row(s) affected)
(1 row(s) affected)
NHibernate then throws an exception like this: "Unexpected row count: 2; expected: 1"
I'm essentially looking an equivalent to "SET NOCOUNT ON" from within the session.
Any ideas?
And you can't update the trigger to disable/enable the SET NOCOUNT before/after the trigger's code ?
SET NOCOUNT ON -- your trigger SET NOCOUNT OFF
这篇关于NHibernate的 - 更新一个表的触发器会导致一个错误 - 意外的行数:2;预计:1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!