/// <summary> /// Executes the stored procedure to insert a trace message into SQL. /// </summary> /// <param name="message">Trace message to insert into the database.</param> /// <param name="helpLink">Help link to insert into the database.</param> /// <param name="source">Source of the trace message to insert into the database.</param> /// <param name="stackTrace">Stack trace of the trace message to insert into the database.</param> /// <param name="traceData">Data associated with the trace event.</param> /// <param name="traceEventType">Type of the trace event.</param> /// <param name="traceId">Id of the trace message to insert into the database.</param> /// <param name="correlationId">Optional correlation Id of the trace message to insert into the database.</param> /// <param name="correlationIndex">Optional correlation index of the trace message to insert into the database.</param> /// <param name="processId">Process Id to insert into the database.</param> /// <param name="threadId">Thread Id to insert into the database.</param> /// <returns>Primary key Id of the record that was inserted into that database.</returns> private long InsertMessage( string message, string helpLink, string source, string stackTrace, XmlDocument traceData, TraceEventType traceEventType, int traceId, Nullable<Guid> correlationId, Nullable<short> correlationIndex, int processId, string threadId) { string connectionString = this.GetConnectionString(); var assembly = Assembly.GetExecutingAssembly(); var assemblyName = assembly.GetName(); var repository = new ApplicationLogRepository(connectionString); var applicationLog = new ApplicationLogDao { AppDomainName = AppDomain.CurrentDomain.FriendlyName, Assembly = new AssemblyDao { AssemblyFullName = assemblyName.FullName, AssemblyName = assemblyName.Name, VersionBuild = assemblyName.Version.Build, VersionMajor = assemblyName.Version.Major, VersionMinor = assemblyName.Version.Minor, VersionRevision = assemblyName.Version.Revision }, CorrelationId = correlationId, CorrelationIndex = correlationIndex, Data = traceData, HelpLink = helpLink, MachineName = Environment.MachineName, Message = message, ProcessId = processId, Source = source, StackTrace = stackTrace, ThreadId = threadId, TraceEventType = traceEventType, TraceId = traceId, TraceListenerName = this.Name }; long applicationLogId = repository.Create(applicationLog); return applicationLogId; }