예제 #1
0
        public T UsingCommand(string commandText)
        {
            if (this.activeScript != null)
            {
                this.scriptsToExecute.Add(this.activeScript);
            }

            this.activeScript         = new ScriptDetail();
            this.activeScript.Command = commandText;
            return((T)(object)this);
        }
예제 #2
0
            /// <summary>
            /// Used by libraries to trace their output.
            /// </summary>
            /// <typeparam name="T"></typeparam>
            /// <param name="threadId">Optional: The thread id that was used to execute the script</param>
            /// <param name="script">The script detail that has executed</param>
            /// <param name="result">The result of the script execution</param>
            /// <param name="ex">Optional Exception that may have occured</param>
            /// <remarks>
            /// The method needs to take the ThreadId parameter as ThreadId is not available in PCLs.
            /// </remarks>
            public static void Trace(int threadId, ScriptDetail script, Result result, Exception ex = null)
            {
                var entry = new TraceEntry
                {
                    Script        = script.Command,
                    InParameters  = script.InParameters,
                    OutParameters = script.OutParameters,
                    ThreadId      = threadId,
                    Result        = result,
                    Exception     = ex,
                };

                lock (lockObject)
                {
                    _traceEntries.Add(entry);
                }
            }