using System.Collections.Concurrent;
using System.Threading;
namespace ASC.Common.Notify.Engine
{
///
/// Provides a way to set contextual data that flows with the call and
/// async context of a test or invocation.
///
public static class CallContext
{
static readonly ConcurrentDictionary> state = new ConcurrentDictionary>();
///
/// Stores a given object and associates it with the specified name.
///
/// The name with which to associate the new item in the call context.
/// The object to store in the call context.
public static void SetData(string name, object data) =>
state.GetOrAdd(name, _ => new AsyncLocal