Exemplo n.º 1
0
        internal static TimeSeriesHierarchy DeserializeTimeSeriesHierarchy(JsonElement element)
        {
            Optional <string>         id     = default;
            string                    name   = default;
            TimeSeriesHierarchySource source = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("source"))
                {
                    source = TimeSeriesHierarchySource.DeserializeTimeSeriesHierarchySource(property.Value);
                    continue;
                }
            }
            return(new TimeSeriesHierarchy(id.Value, name, source));
        }
        public TimeSeriesHierarchy(string name, TimeSeriesHierarchySource source)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            Name   = name;
            Source = source;
        }
 internal TimeSeriesHierarchy(string id, string name, TimeSeriesHierarchySource source)
 {
     Id     = id;
     Name   = name;
     Source = source;
 }