/// <summary> /// Gets the single resource json:api relationships 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 relationships object with.</param> /// <returns>Returns the single json:api relationships 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 Relationships GetResourceRelationships <TResource, TResourceId>(this IDocumentReader documentReader, TResourceId clrResourceId) where TResource : class, IResource { Contract.Requires(documentReader != null); var clrResourceType = typeof(TResource); var apiResourceRelationships = documentReader.GetResourceRelationships(clrResourceType, clrResourceId); return(apiResourceRelationships); }