GetExecutionContextData(LoggingExecutionContextData, bool)
Returns a new layer for the async stack that has this LoggingContext as the associated activity and current as the
PostSharp.Patterns.Diagnostics.Contexts.LoggingExecutionContextData.Parent, if a new layer is required.
Declaration
protected virtual LoggingExecutionContextData GetExecutionContextData(LoggingExecutionContextData current, bool requireNew)Parameters
| Type | Name | Description |
|---|---|---|
| LoggingExecutionContextData | current | The layer in the async stack that is currently on top. It will become the parent of the new layer. |
| bool | requireNew | If |
Returns
| Type | Description |
|---|---|
| LoggingExecutionContextData | The LoggingExecutionContextData to be put on top of the async stack, or |
Remarks
The flow is:
- LoggingContext.UpdateExecutionContextData calls LoggingContext.GetExecutionContextData, which is virtual.
- GetExecutionContextData returns null if no new layer needs to be created, or returns the new layer, fully edited, otherwise.
- The implementation in the LoggingContext class creates a copy using "LoggingExecutionContextData.Clone" which may create a subclass.
- Implementors must call the base class so that the synthetic ID, the logging properties, and other such data are filled in.