SqlTriggerAttribute 클래스

정의

SQL Server에서 어셈블리의 메서드 정의를 트리거로 표시하는 데 사용됩니다. 특성의 속성은 SQL Server에 형식을 등록할 때 사용되는 실제 특성을 반영합니다. 이 클래스는 상속될 수 없습니다.

public ref class SqlTriggerAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
[System.Serializable]
public sealed class SqlTriggerAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
[<System.Serializable>]
type SqlTriggerAttribute = class
    inherit Attribute
Public NotInheritable Class SqlTriggerAttribute
Inherits Attribute
상속
SqlTriggerAttribute
특성

예제

다음 예제와 SqlTriggerAttribute 트리거, 대상 테이블 및 트리거를 발생 시킬 이벤트의 이름을 지정 합니다. 참조 SqlTriggerContext 전체 트리거 예제에 대 한 합니다.

[SqlTrigger(Name = @"SalesAudit", Target = "[dbo].[SalesInfo]", Event = "FOR INSERT")]
public static void SalesAudit()
{
   // Get the trigger context.
   SqlTriggerContext triggContext = SqlContext.TriggerContext;

   switch (triggContext.TriggerAction)
   {
      case TriggerAction.Insert:

      // Do something in response to the INSERT.

      break;
   }
}
<SqlTrigger(Name:="SalesAudit", Target:="[dbo].[SalesInfo]", Event:="FOR INSERT")> _
Public Shared Sub SalesAudit()
        
   Dim triggContext As SqlTriggerContext
         
   ' Get the trigger context.
   triggContext = SqlContext.TriggerContext        

   Select Case triggContext.TriggerAction
      Case TriggerAction.Insert
      
      ' Do something in response to the INSERT.
         
   End Select

End Sub

설명

CLR 트리거 및 예제에 대 한 자세한 내용은 SQL Server 2005 온라인 설명서의 "CLR 트리거"를 참조 하세요.

생성자

SqlTriggerAttribute()

어셈블리에 있는 메서드 정의의 특성으로, SQL Server에서 메서드를 트리거로 표시하는 데 사용됩니다.

속성

Event

트리거의 형식과 트리거를 활성화한 DML(데이터 조작 언어) 작업입니다.

Name

트리거의 이름입니다.

Target

트리거가 적용되는 테이블입니다.

적용 대상