Esempio n. 1
0
 private LogicalOperation(object data, Guid activityId)
 {
     this.data = data;
     LogicalOperation.StartLogicalOperation(this.data);
     this.previousActivityId             = Trace.CorrelationManager.ActivityId;
     Trace.CorrelationManager.ActivityId = activityId;
 }
Esempio n. 2
0
 private LogicalOperation(object data)
 {
     this.data = data;
     LogicalOperation.StartLogicalOperation(data);
     this.previousActivityId = Trace.CorrelationManager.ActivityId;
     if (Trace.CorrelationManager.ActivityId == Guid.Empty)
     {
         Trace.CorrelationManager.ActivityId = Guid.NewGuid();
     }
 }
Esempio n. 3
0
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (!LogicalOperation.IsRunningInAdapter && LogicalOperation.GetLogicalOperationStack().Peek() != this.data)
         {
             throw new InvalidOperationException("Logical operation stack has been corrupted");
         }
         LogicalOperation.StopLogicalOperation();
         Trace.CorrelationManager.ActivityId = this.previousActivityId;
     }
 }
Esempio n. 4
0
        private static IImmutableStack <object> GetLogicalOperationStack()
        {
            IImmutableStack <object> empty = (IImmutableStack <object>)CallContext.LogicalGetData(LogicalOperation.CallContextDataSlotName);

            if (empty == null)
            {
                empty = ImmutableLogicalOperationStack <object> .Empty;
                if (LogicalOperation.IsRunningInAdapter)
                {
                    empty = empty.Push(new object());
                }
                LogicalOperation.UpdateImmutableStack(empty);
            }
            return(empty);
        }
Esempio n. 5
0
 public static void Log(this ILogger logger, TraceEventType eventType, string message, string category)
 {
     if (category == null)
     {
         logger.WriteEntry(new LogEntry()
         {
             EventType = eventType,
             Message   = message
         });
     }
     else
     {
         using (LogicalOperation.Create(category, new object[0]))
             logger.WriteEntry(new LogEntry()
             {
                 EventType = eventType,
                 Message   = message
             });
     }
 }
Esempio n. 6
0
 private static void StopLogicalOperation()
 {
     LogicalOperation.UpdateImmutableStack(LogicalOperation.GetLogicalOperationStack().Pop());
 }
Esempio n. 7
0
 private static void StartLogicalOperation(object data)
 {
     LogicalOperation.UpdateImmutableStack(LogicalOperation.GetLogicalOperationStack().Push(data));
 }