Example #1
0
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity, Guid iid, int instanceID, bool traceContextTransaction)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusMethodCallSchema schema = null;
         Guid empty = Guid.Empty;
         if (traceContextTransaction)
         {
             IComThreadingInfo info2 = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
             if (info2 != null)
             {
                 IObjectContextInfo info3 = info2 as IObjectContextInfo;
                 if ((info3 != null) && info3.IsInTransaction())
                 {
                     info3.GetTransactionId(out empty);
                 }
             }
             if (empty != Guid.Empty)
             {
                 schema = new ComPlusMethodCallContextTxSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, empty);
             }
         }
         else
         {
             schema = new ComPlusMethodCallSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity);
         }
         if (schema != null)
         {
             TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord)schema);
         }
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity, Guid iid, int instanceID, bool traceContextTransaction)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusMethodCallSchema schema = null;
         Guid empty = Guid.Empty;
         if (traceContextTransaction)
         {
             IComThreadingInfo info2 = (IComThreadingInfo) SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
             if (info2 != null)
             {
                 IObjectContextInfo info3 = info2 as IObjectContextInfo;
                 if ((info3 != null) && info3.IsInTransaction())
                 {
                     info3.GetTransactionId(out empty);
                 }
             }
             if (empty != Guid.Empty)
             {
                 schema = new ComPlusMethodCallContextTxSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, empty);
             }
         }
         else
         {
             schema = new ComPlusMethodCallSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity);
         }
         if (schema != null)
         {
             TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
         }
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity,
                          Guid iid, int instanceID, bool traceContextTransaction)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusMethodCallSchema record = null;
         Guid guidContextTrsansactionID = Guid.Empty;
         if (traceContextTransaction)
         {
             IComThreadingInfo comThreadingInfo;
             comThreadingInfo = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
             if (comThreadingInfo != null)
             {
                 IObjectContextInfo contextInfo = comThreadingInfo as IObjectContextInfo;
                 if (contextInfo != null)
                 {
                     if (contextInfo.IsInTransaction())
                     {
                         contextInfo.GetTransactionId(out guidContextTrsansactionID);
                     }
                 }
             }
             if (guidContextTrsansactionID != Guid.Empty)
             {
                 record = new ComPlusMethodCallContextTxSchema(from, info.AppID, info.Clsid, iid, action,
                                                               instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, guidContextTrsansactionID);
             }
         }
         else
         {
             record = new ComPlusMethodCallSchema(from, info.AppID, info.Clsid, iid, action,
                                                  instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity);
         }
         if (record != null)
         {
             TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
         }
     }
 }
        public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity,
                            Guid iid, int instanceID, bool traceContextTransaction)
        {
            if (DiagnosticUtility.ShouldTrace(type))
            {

                ComPlusMethodCallSchema record = null;
                Guid guidContextTrsansactionID = Guid.Empty;
                if (traceContextTransaction)
                {
                    IComThreadingInfo comThreadingInfo;
                    comThreadingInfo = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
                    if (comThreadingInfo != null)
                    {
                        IObjectContextInfo contextInfo = comThreadingInfo as IObjectContextInfo;
                        if (contextInfo != null)
                        {
                            if (contextInfo.IsInTransaction())
                                contextInfo.GetTransactionId(out guidContextTrsansactionID);
                        }
                    }
                    if (guidContextTrsansactionID != Guid.Empty)
                    {
                        record = new ComPlusMethodCallContextTxSchema(from, info.AppID, info.Clsid, iid, action,
                        instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, guidContextTrsansactionID);
                    }
                }
                else
                {
                    record = new ComPlusMethodCallSchema(from, info.AppID, info.Clsid, iid, action,
                    instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity);
                }
                if (record != null)
                    TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
            }
        }