Example #1
0
        /// <summary>
        /// 初始化Trigger的Num
        /// 如果不替换UniqueId,则可以填-1
        /// </summary>
        /// <param name="triggerId">Trigger identifier.</param>
        public void Init(TriggerConfigData config, int uniqueId)
        {
            cfg = config;
            if (uniqueId > 0)
            {
                TriggerId = uniqueId;
            }
            if (cfg != null)
            {
                switch (config.tEnd)
                {
                case TriEnd.Recount:
                    workOnEnd = null;
                    break;

                case TriEnd.Rm_Buff_Trigger:
                    workOnEnd = new RmBuffWithTrigger();
                    break;

                case TriEnd.Rm_Buff_Layer:
                    workOnEnd = null;
                    break;

                case TriEnd.Rm_Trigger:
                    workOnEnd = new RmTrigger();
                    break;
                }
            }
        }
 static string BuildNodeText(ICommand command)
 {
     return(command switch
     {
         IAttachmentStart c => $"Attachment {c.ConnectionId}: {c.RemoteProcessName} ({c.DatabaseName})",
         ITransactionStart c => $"Transaction {c.TransactionId} Start: {c.IsolationMode} (RO: {c.ReadOnly} | RV: {c.RecordVersion} | W: {c.Wait})",
         ITransactionEnd c => $"Transaction {c.TransactionId} End ({c.ElapsedTime.TotalMilliseconds} ms): {c.Command}",
         IStatementPrepare c => $"Statement {c.StatementId} Prepare ({c.ElapsedTime.TotalMilliseconds} ms): {c.Text.Escape()}",
         IStatementStart c => $"Statement {c.StatementId} Start: {c.Text.Escape()}",
         IStatementFinish c => $"Statement {c.StatementId} Finish ({c.ElapsedTime.TotalMilliseconds} ms): {c.Text.Escape()}",
         IStatementClose c => $"Statement {c.StatementId} Close",
         IStatementFree c => $"Statement {c.StatementId} Free",
         ITriggerStart c => $"Trigger '{c.TriggerName}' Start",
         ITriggerEnd c => $"Trigger '{c.TriggerName}' End ({c.ElapsedTime.TotalMilliseconds} ms)",
         IProcedureStart c => $"Procedure '{c.ProcedureName}' Start",
         IProcedureEnd c => $"Procedure '{c.ProcedureName}' End ({c.ElapsedTime.TotalMilliseconds} ms)",
         IFunctionStart c => $"Function '{c.FunctionName}' Start",
         IFunctionEnd c => $"Function '{c.FunctionName}' End ({c.ElapsedTime.TotalMilliseconds} ms)",
         ISetContext c => $"Set Context: {c.VariableName}",
         IErrorAt c => $"Error {c.Error.Escape()}",
         _ => command.GetType().Name,
     });