VistaDB 5






VistaDB.DDA Namespace > IVistaDBDatabase Interface : RegisterClrTrigger Method
The CLR Trigger custom name to register
The full name of CLR Trigger hosted method. The name should include namespace the CLR Trigger belongs to. The procedure should be static
The name of assembly registered in database with CreateAssembly or UpdateAssembly
The name of table the trigger is set on
The table level event to fire trigger
User's description for this procedure. May be null (Nothing in VB.NET) to exclude a description.
RegisterClrTrigger Method
Looks for CLR Trigger in assembly. If CLR Trigger found, registers user provided name.
Syntax
'Declaration
 
Sub RegisterClrTrigger( _
   ByVal triggerName As System.String, _
   ByVal clrHostedMethod As System.String, _
   ByVal assemblyName As System.String, _
   ByVal tableName As System.String, _
   ByVal triggerAction As TriggerAction, _
   ByVal description As System.String _
) 
'Usage
 
Dim instance As IVistaDBDatabase
Dim triggerName As System.String
Dim clrHostedMethod As System.String
Dim assemblyName As System.String
Dim tableName As System.String
Dim triggerAction As TriggerAction
Dim description As System.String
 
instance.RegisterClrTrigger(triggerName, clrHostedMethod, assemblyName, tableName, triggerAction, description)
void RegisterClrTrigger( 
   System.string triggerName,
   System.string clrHostedMethod,
   System.string assemblyName,
   System.string tableName,
   TriggerAction triggerAction,
   System.string description
)
procedure RegisterClrTrigger( 
    triggerName: System.String;
    clrHostedMethod: System.String;
    assemblyName: System.String;
    tableName: System.String;
    triggerAction: TriggerAction;
    description: System.String
); 
function RegisterClrTrigger( 
   triggerName : System.String,
   clrHostedMethod : System.String,
   assemblyName : System.String,
   tableName : System.String,
   triggerAction : TriggerAction,
   description : System.String
);
void RegisterClrTrigger( 
   System.string* triggerName,
   System.string* clrHostedMethod,
   System.string* assemblyName,
   System.string* tableName,
   TriggerAction triggerAction,
   System.string* description
) 
void RegisterClrTrigger( 
   System.String^ triggerName,
   System.String^ clrHostedMethod,
   System.String^ assemblyName,
   System.String^ tableName,
   TriggerAction triggerAction,
   System.String^ description
) 

Parameters

triggerName
The CLR Trigger custom name to register
clrHostedMethod
The full name of CLR Trigger hosted method. The name should include namespace the CLR Trigger belongs to. The procedure should be static
assemblyName
The name of assembly registered in database with CreateAssembly or UpdateAssembly
tableName
The name of table the trigger is set on
triggerAction
The table level event to fire trigger
description
User's description for this procedure. May be null (Nothing in VB.NET) to exclude a description.
Remarks
Current version supports DML triggers. Only AfterInsert, AfterUpdate and AfterDelete actions supported by CLR Triggers

Also note that the DLL containing the CLR Trigger is loaded INTO the database and is no longer required. This is to prevent a situation where the DLL is deleted or no longer with the database causing the database to no longer work.

During development of a CLR Trigger you will have to Unregister and Register the CLRTrigger into the database each time you rebuild your DLL for the changes to be loaded. The database does not look at the DLL after this initial registration.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also