Esempio n. 1
0
 internal CacheProfile(string name, string skuName, RedisCacheFamily family, long capacity, ResourceIdentifier cacheResourceId)
 {
     Name            = name;
     SkuName         = skuName;
     Family          = family;
     Capacity        = capacity;
     CacheResourceId = cacheResourceId;
 }
Esempio n. 2
0
        public CacheProfile(string skuName, RedisCacheFamily family, long capacity)
        {
            if (skuName == null)
            {
                throw new ArgumentNullException(nameof(skuName));
            }

            SkuName  = skuName;
            Family   = family;
            Capacity = capacity;
        }
Esempio n. 3
0
        internal static CacheProfile DeserializeCacheProfile(JsonElement element)
        {
            Optional <string> name    = default;
            string            skuName = default;
            RedisCacheFamily  family  = default;
            long capacity             = default;
            Optional <ResourceIdentifier> cacheResourceId = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("skuName"))
                {
                    skuName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("family"))
                {
                    family = new RedisCacheFamily(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("capacity"))
                {
                    capacity = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("cacheResourceId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    cacheResourceId = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
            }
            return(new CacheProfile(name.Value, skuName, family, capacity, cacheResourceId.Value));
        }