我正嘗試將.net內核移入使用CallContext.LogicalGet/SetData的現有.net應用程序。.NET Core等價於CallContext.LogicalGet/SetData
當一個Web請求到達應用程序時,我在CallContext中保存一個CorrelationId,並且每當我需要記錄稍後的事件時,我都可以從CallContext輕鬆收集它,而無需將它傳輸到任何地方。
因爲.net核心不再支持CallContext,因爲它是System.Messaging的一部分.Remoting有哪些選項?
我看到的一個版本是可以使用AsyncLocal(How do the semantics of AsyncLocal differ from the logical call context?),但它看起來好像我將不得不將這個變量全部傳輸到哪個目標上,它並不方便。