/// <summary> /// Merges the specified context. /// </summary> /// <param name="context">The context.</param> /// <returns></returns> public IContextBag Merge(IContextBag context) { foreach (var extension in context) { Set(extension); } return(this); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultMessageContext" /> class. /// </summary> /// <param name="provider">The provider.</param> /// <param name="options">The options.</param> /// <param name="extensions">The extensions.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <exception cref="ArgumentNullException">extensions</exception> public DefaultMessageContext( IServiceProvider provider, IOptionsSnapshot <MessageConfiguration> options, IContextBag extensions, CancellationToken cancellationToken) { _provider = provider ?? throw new ArgumentNullException(nameof(provider)); _options = options ?? throw new ArgumentNullException(nameof(options)); Extensions = extensions ?? throw new ArgumentNullException(nameof(extensions)); CancellationToken = cancellationToken; }