Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think those concepts (Activity and LogicalOperation) are orthogonal. You could have an Activity that has many LogicalOperations inside. Or, you could have a LogicalOperation where the Activity could change. I would guess it would be more common that the Activity is at a higher level than the LogicalOperation.</p> <p>It is probably not very helpful of me to say so, but it is up to you do decide what makes most sense to you and your application as far as organizing your logging.</p> <p>I suspect that it would be common to have a single request result in a single Activity.</p> <p>You might find it helpful to have helper classes to make it easier to manage the Activity and LogicalOperation. Something like this:</p> <pre><code>class ActivityScope : IDisposable { Guid oldActivity; ActivityScope() { oldActivity = System.Diagnostics.CorrelationManager.ActivityId; System.Diagnostics.CorrelationManager.ActivityId = Guid.NewGuid(); } public void Dispose() { System.Diagnostics.CorrelationManager.ActivityId = oldActivity; } } class LogicalOperationScope : IDisposable { public LogicalOperationScope(string logicalOperation) { System.Diagnostics.CorrelationManager.StartLogicalOperation(logicalOperation); } public void Dispose() { System.Diagnostics.CorrelationManager.StopLogicalOperation(); } } </code></pre> <p>You can use them like this:</p> <pre><code>void ServiceARequest() { using (new ActivityScope()) { //Do some stuff using (new LogicalOperationScope("SomeWork")) { DoSomeWork(); for (int i = 0; i &lt; 10; i++) { using (new LogicalOperationScope(string.Format("nested {0}", i)) { DoNestedWork(i); } } } } } void DoSomeWork() { using (new LogicalOperationScope("DoSomeWork")) { } } void DoNestedWork(int level) { } </code></pre> <p>Obviously my example is heavy on diagnostic code and light on real code, but you get the idea. If it makes sense to you to have an ActivityId or a LogicalOperation, try managing them with "scope" classes similar to this.</p> <p>Good luck!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload