/// <summary> /// Gets the single resource json:api links object by resource identifier lookup. /// </summary> /// <typeparam name="TResource">Type of CLR resource.</typeparam> /// <typeparam name="TResourceId">Type of CLR resource identifier.</typeparam> /// <param name="clrResourceId">CLR resource identifier value to lookup the single json:api links object with.</param> /// <returns>Returns the single json:api links object if found, null otherwise.</returns> /// <exception cref="DocumentReadException">Is thrown if there are /// multiple CLR resources with the same resource identifier for the given CLR resource type.</exception> public static Links GetResourceLinks <TResource, TResourceId>(this IDocumentReader documentReader, TResourceId clrResourceId) where TResource : class, IResource { Contract.Requires(documentReader != null); var clrResourceType = typeof(TResource); var apiResourceLinks = documentReader.GetResourceLinks(clrResourceType, clrResourceId); return(apiResourceLinks); }