コード例 #1
0
        public async Task <IRtmLocation> GetLocationByIdAsync(string locationId)
        {
            if (string.IsNullOrEmpty(locationId))
            {
                throw new ArgumentNullException(nameof(locationId));
            }

            var location = await _locationCache.GetByIdAsync(locationId).ConfigureAwait(false);

            if (location == null)
            {
                await RefreshLocationCache().ConfigureAwait(false);

                location = await _locationCache.GetByIdAsync(locationId).ConfigureAwait(false);

                if (location == null)
                {
                    throw new InvalidOperationException($"The specified location ID does not exist.  ID = {locationId}");
                }
            }

            return(location);
        }