/// <summary>
 /// Creates an instance of <see cref="HalEmbeddedResourceBuilder"/>.
 /// </summary>
 /// <param name="resource">The target resource.</param>
 public HalEmbeddedResourceBuilder(IHalResource resource) {
     if (resource == null) {
         throw new ArgumentNullException("resource");
     }
     _resource = resource;
     _linkCollection = new HalLinkCollection();
 }
Пример #2
0
 /// <summary>
 /// Creates an instance of <see cref="HalEmbeddedResourceBuilder"/>.
 /// </summary>
 /// <param name="resource">The target resource.</param>
 public HalEmbeddedResourceBuilder(IHalResource resource)
 {
     if (resource == null)
     {
         throw new ArgumentNullException("resource");
     }
     _resource       = resource;
     _linkCollection = new HalLinkCollection();
 }
 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);
        }
Пример #5
0
 /// <summary>
 /// Creates an instance of <see cref="HalDocument"/>.
 /// </summary>
 /// <param name="resource">The hypermedia aware resource.</param>
 /// <param name="linkCollection">A collection of hypermedia links.</param>
 /// <param name="embeddedResourceCollection">A collection of embedded resources.</param>
 internal HalDocument(IHalResource resource, HalLinkCollection linkCollection,
                      HalEmbeddedResourceCollection embeddedResourceCollection)
     : this(resource, linkCollection) {
     _embeddedResourceCollection = embeddedResourceCollection;
 }
Пример #6
0
 /// <summary>
 /// Creates an instance of <see cref="HalDocument"/>.
 /// </summary>
 /// <param name="resource">The hypermedia aware resource.</param>
 /// <param name="linkCollection">A collection of hypermedia links.</param>
 internal HalDocument(IHalResource resource, HalLinkCollection linkCollection) {
     _resource = resource;
     _linkCollection = linkCollection;
 }
Пример #7
0
 /// <summary>
 /// Creates an instance of <see cref="HalDocument"/>.
 /// </summary>
 /// <param name="resource">The hypermedia aware resource.</param>
 /// <param name="linkCollection">A collection of hypermedia links.</param>
 /// <param name="embeddedResourceCollection">A collection of embedded resources.</param>
 internal HalDocument(IHalResource resource, HalLinkCollection linkCollection,
                      HalEmbeddedResourceCollection embeddedResourceCollection)
     : this(resource, linkCollection)
 {
     _embeddedResourceCollection = embeddedResourceCollection;
 }
Пример #8
0
 /// <summary>
 /// Creates an instance of <see cref="HalDocument"/>.
 /// </summary>
 /// <param name="resource">The hypermedia aware resource.</param>
 /// <param name="linkCollection">A collection of hypermedia links.</param>
 internal HalDocument(IHalResource resource, HalLinkCollection linkCollection)
 {
     _resource       = resource;
     _linkCollection = linkCollection;
 }