/// <summary> /// Add context value with given key. The value will be ignored if the key already exists. /// </summary> public void AddContextValue(string key, ITransactionContextItem value) { Debug.Assert(_efiTransactionContext.Contains(key) == false, "Key: " + key + " already exists in the context."); if (_efiTransactionContext.Contains(key) == false) { _efiTransactionContext.Add(key, value); } }
/// <summary> /// Associate a value with a particular key in the transaction context. /// </summary> /// <param name="key">The key to associate the value with. Cannot be null.</param> /// <param name="value">The value to be associated with the key. Can be null.</param> /// <remarks>Suggested best practice is to use GUIDs for the keys to ensure uniqueness</remarks> public void Add(string key, ITransactionContextItem value) { if (key == null) { throw new ArgumentNullException("key"); } _contextInfo[key] = value; }