| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | using System.Collections.Immutable; |
| | | 4 | | |
| | | 5 | | namespace IceRpc.Features; |
| | | 6 | | |
| | | 7 | | /// <summary>Default implementation of <see cref="IRequestContextFeature" />.</summary> |
| | | 8 | | public sealed class RequestContextFeature : IRequestContextFeature |
| | | 9 | | { |
| | | 10 | | /// <inheritdoc/> |
| | 31 | 11 | | public IReadOnlyDictionary<string, string> Value { get; } |
| | | 12 | | |
| | | 13 | | /// <summary>Constructs an empty request context feature.</summary> |
| | 0 | 14 | | public RequestContextFeature() => Value = ImmutableDictionary<string, string>.Empty; |
| | | 15 | | |
| | | 16 | | /// <summary>Constructs a request context feature wrapping the specified dictionary.</summary> |
| | | 17 | | /// <param name="value">The dictionary held by the new feature. It is copied to an |
| | | 18 | | /// <see cref="ImmutableDictionary{TKey, TValue}" /> unless it is already one, so post-construction mutations |
| | | 19 | | /// to <paramref name="value" /> cannot alter the feature.</param> |
| | 46 | 20 | | public RequestContextFeature(IReadOnlyDictionary<string, string> value) => Value = value.ToImmutableDictionary(); |
| | | 21 | | } |