callcontext

.NET Core equivalent of CallContext.LogicalGet/SetData

喜你入骨 提交于 2019-12-06 19:45:52
问题 I am trying to move into .net core an existing .net application that is using CallContext.LogicalGet/SetData. When a web request hits the application I save a CorrelationId in the CallContext and whenever I need to log something later down the track I can easily collect it from the CallContext, without the need to transfer it everywhere. As CallContext is no longer supported in .net core since it is part of System.Messaging.Remoting what options are there? One version I have seen is that the

.NET Core equivalent of CallContext.LogicalGet/SetData

陌路散爱 提交于 2019-12-05 00:24:24
I am trying to move into .net core an existing .net application that is using CallContext.LogicalGet/SetData. When a web request hits the application I save a CorrelationId in the CallContext and whenever I need to log something later down the track I can easily collect it from the CallContext, without the need to transfer it everywhere. As CallContext is no longer supported in .net core since it is part of System.Messaging.Remoting what options are there? One version I have seen is that the AsyncLocal could be used ( How do the semantics of AsyncLocal differ from the logical call context? )