Пример #1
0
 internal LinkConnectionResource(string id, string name, string type, LinkConnection properties)
 {
     Id         = id;
     Name       = name;
     Type       = type;
     Properties = properties;
 }
        internal static LinkConnectionResource DeserializeLinkConnectionResource(JsonElement element)
        {
            Optional <string> id         = default;
            Optional <string> name       = default;
            Optional <string> type       = default;
            LinkConnection    properties = 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("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    properties = LinkConnection.DeserializeLinkConnection(property.Value);
                    continue;
                }
            }
            return(new LinkConnectionResource(id.Value, name.Value, type.Value, properties));
        }
Пример #3
0
        public LinkConnectionResource(LinkConnection properties)
        {
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            Properties = properties;
        }