Example #1
0
 internal DescendantData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, DescendantParentGroupInfo parent) : base(id, name, resourceType, systemData)
 {
     DisplayName = displayName;
     Parent      = parent;
 }
Example #2
0
        internal static DescendantData DeserializeDescendantData(JsonElement element)
        {
            ResourceIdentifier id          = default;
            string             name        = default;
            ResourceType       type        = default;
            SystemData         systemData  = default;
            Optional <string>  displayName = default;
            Optional <DescendantParentGroupInfo> parent = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("displayName"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                displayName = null;
                                continue;
                            }
                            displayName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("parent"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                parent = null;
                                continue;
                            }
                            parent = DescendantParentGroupInfo.DeserializeDescendantParentGroupInfo(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DescendantData(id, name, type, systemData, displayName.Value, parent.Value));
        }