Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StateEntry{TValue}"/> class.
        /// </summary>
        /// <param name="client">The <see cref="StateClient" /> instance used to retrieve the value.</param>
        /// <param name="key">The state key.</param>
        /// <param name="value">The value.</param>
        /// <remarks>
        /// Application code should not need to create instances of <see cref="StateEntry{T}" />. Use
        /// <see cref="StateClient.GetStateEntryAsync{TValue}(string, CancellationToken)" /> to access
        /// state entries.
        /// </remarks>
        public StateEntry(StateClient client, string key, TValue value)
        {
            if (client is null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentException("The value cannot be null or empty.", nameof(key));
            }

            this.Key    = key;
            this.Value  = value;
            this.client = client;
        }
Пример #2
0
 private static async Task <object> GetStateAsync <T>(StateClient stateClient, string storeName, string key)
 {
     return(await stateClient.GetStateAsync <T>(storeName, key));
 }
Пример #3
0
 private static async Task <object> GetStateEntryAsync <T>(StateClient stateClient, string key)
 {
     return(await stateClient.GetStateEntryAsync <T>(key));
 }