Exemplo n.º 1
0
        internal ServiceStatistics(ServiceCounters counters, ServiceLimits limits)
        {
            if (counters == null)
            {
                throw new ArgumentNullException(nameof(counters));
            }
            if (limits == null)
            {
                throw new ArgumentNullException(nameof(limits));
            }

            Counters = counters;
            Limits   = limits;
        }
Exemplo n.º 2
0
        internal static ServiceStatistics DeserializeServiceStatistics(JsonElement element)
        {
            ServiceCounters counters = default;
            ServiceLimits   limits   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("counters"))
                {
                    counters = ServiceCounters.DeserializeServiceCounters(property.Value);
                    continue;
                }
                if (property.NameEquals("limits"))
                {
                    limits = ServiceLimits.DeserializeServiceLimits(property.Value);
                    continue;
                }
            }
            return(new ServiceStatistics(counters, limits));
        }