/// <summary> /// Adds a relation with a single link to the embedded resource. /// </summary> /// <param name="relation">How the link is related to the resource.</param> /// <param name="link">A hypermedia link.</param> /// <returns>This <see cref="IHalEmbeddedResourceBuilder"/> instance.</returns> public IHalEmbeddedResourceBuilder IncludeRelationWithSingleLink(HalRelation relation, HalLink link) { if (relation == null) { throw new ArgumentNullException("relation"); } if (link == null) { throw new ArgumentNullException("link"); } _linkCollection.Add(relation, link); return(this); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var ret = new HalLinkCollection(); var obj = JObject.Load(reader); var enumerator = obj.GetEnumerator(); while (enumerator.MoveNext()) { var link = JsonConvert.DeserializeObject<HalLink>(enumerator.Current.Value.ToString()); link.Rel = enumerator.Current.Key; ret.Add(link); } return ret; }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var ret = new HalLinkCollection(); var obj = JObject.Load(reader); var enumerator = obj.GetEnumerator(); while (enumerator.MoveNext()) { var link = JsonConvert.DeserializeObject <HalLink>(enumerator.Current.Value.ToString()); link.Rel = enumerator.Current.Key; ret.Add(link); } return(ret); }