コード例 #1
0
        public async Task <List <T> > GetAll(string serviceRegistryUrl)
        {
            var response = string.Empty;

            try
            {
                response = await _httpClient.GetStringAsync(serviceRegistryUrl + "/items");
            }
            catch {}
            var items = Deserialize(response);

            if (items.Count > 0)
            {
                try
                {
                    await _localCache.Save(Serialize(items));
                }
                catch {}
            }
            else
            {
                try
                {
                    var content = await _localCache.Read();

                    if (!string.IsNullOrEmpty(content))
                    {
                        items = Deserialize(content);
                    }
                }
                catch {}
            }

            return(items);
        }