Linq-to-sql сбой при вставке и обновлении, когда это прикрепленный триггер

I am having some problems with linq-to-sql lately. The problem is that it “thinks” that it fails on inserts and updates when we have a trigger attached to the event. An example could be a row, where a trigger is attached to set the “LastUpdated” colon to the current time, when a row is altered. This will cause linq-to-sql to think that is have failed on the update or insert, but this is only some times, as it sometimes go through, I think this is when the sql server is under heavy load and where therefore not able to execute the trigger before the validation was made, this is only speculation. As my scripts are only a part of a much bigger script, so disabling the trigger is not an option, so I need to find a solution to this, or rewrite my program. Кто-нибудь из вас сталкивался с этой проблемой и нашел решение, например отключение проверки после вставки?

Триггер.

USE [cnhha]
GO
/****** Object:  Trigger [dbo].[LastUpdated]    Script Date: 05/12/2011 16:26:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[LastUpdated] ON [dbo].[CN_User] 
FOR INSERT, UPDATE
AS

update cn_user set lastupdated=getdate() where campusnetuserid in (select campusnetuserid from inserted)
11
задан gbn 13 May 2011 в 15:31
поделиться