Esempio n. 1
0
        public TargetRelation(TargetRelationType relationType, string @ref)
        {
            if (@ref == null)
            {
                throw new ArgumentNullException(nameof(@ref));
            }

            RelationType = relationType;
            Ref          = @ref;
        }
Esempio n. 2
0
        internal static TargetRelation DeserializeTargetRelation(JsonElement element)
        {
            TargetRelationType relationType = default;
            string             @ref         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("relationType"))
                {
                    relationType = property.Value.GetString().ToTargetRelationType();
                    continue;
                }
                if (property.NameEquals("ref"))
                {
                    @ref = property.Value.GetString();
                    continue;
                }
            }
            return(new TargetRelation(relationType, @ref));
        }
Esempio n. 3
0
 public static string ToSerialString(this TargetRelationType value) => value switch
 {