1 //------------------------------------------------------------------------------
2 // <copyright file="SqlTriggerContext.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // <owner current="true" primary="true">Microsoft</owner>
6 // <owner current="true" primary="false">Microsoft</owner>
7 // <owner current="true" primary="false">daltodov</owner>
8 //------------------------------------------------------------------------------
10 namespace Microsoft.SqlServer.Server {
12 using System.Data.Common;
13 using System.Data.SqlClient;
14 using System.Data.SqlTypes;
15 using System.Diagnostics;
17 public sealed class SqlTriggerContext {
19 TriggerAction _triggerAction;
20 bool[] _columnsUpdated;
21 SqlXml _eventInstanceData;
23 internal SqlTriggerContext(TriggerAction triggerAction, bool[] columnsUpdated, SqlXml eventInstanceData) {
24 _triggerAction = triggerAction;
25 _columnsUpdated = columnsUpdated;
26 _eventInstanceData = eventInstanceData;
29 public int ColumnCount {
33 if (null != _columnsUpdated) {
34 result = _columnsUpdated.Length;
40 public SqlXml EventData {
42 return _eventInstanceData;
46 public TriggerAction TriggerAction {
48 return _triggerAction;
52 public bool IsUpdatedColumn(int columnOrdinal) {
53 if (null != _columnsUpdated) {
54 return _columnsUpdated[columnOrdinal]; // will throw IndexOutOfRangeException if it's out of range...
56 throw ADP.IndexOutOfRange(columnOrdinal); // if there aren't any columns, that means IndexOutOfRange too...