Example #1
0
 public override void Write(Utf8JsonWriter writer, CurieLink value, JsonSerializerOptions options)
 {
     writer.WriteStartObject();
     writer.WriteString(propertyNameConvention.Apply("name"), value.Name);
     writer.WriteString(propertyNameConvention.Apply("href"), value.Href.ToString());
     writer.WriteBoolean(propertyNameConvention.Apply("templated"), true);
     writer.WriteEndObject();
 }
Example #2
0
        public override void Write(Utf8JsonWriter writer, Link value, JsonSerializerOptions options)
        {
            writer.WriteStartObject();

            writer.WriteString(propertyNameConvention.Apply("href"), value.Href.ToString());

            if (!string.IsNullOrEmpty(value.Title))
            {
                writer.WriteString(propertyNameConvention.Apply("title"), value.Title);
            }

            if (value.Templated == true)
            {
                writer.WriteString(propertyNameConvention.Apply("templated"), true.ToString());
            }

            writer.WriteEndObject();
        }
Example #3
0
 private string ApplyConvention(string propertyName)
 {
     if (propertyName != "_links" && propertyName != "_embedded")
     {
         return(propertyNameConvention.Apply(propertyName));
     }
     else
     {
         return(propertyName);
     }
 }