/// <summary> /// Returns like metadata class used to specify URIs not associated with a specific controller method. /// </summary> /// <param name="meta">Method delegate passed metadata class used to define like metadata.</param> /// <returns>Reference to self for method chaining.</returns> public TResourceMeta LinkMeta(Action <ResourceLinkMeta <TResource> > meta) { if (meta == null) { throw new ArgumentNullException(nameof(meta), "Metadata delegate not specified."); } var resourceLinkMeta = new ResourceLinkMeta <TResource>(); meta(resourceLinkMeta); AddLinks(resourceLinkMeta.GetResourceLinks()); return((TResourceMeta)this); }
/// <summary> /// Returns link metadata class used to specify controller action methods. /// </summary> /// <typeparam name="TController">The controller type so select action method from.</typeparam> /// <param name="meta">Method delegate passed metadata class used to define link metadata.</param> /// <returns>Reference to self for method chaining.</returns> public TResourceMeta LinkMeta <TController>(Action <ResourceLinkMeta <TController, TResource> > meta) where TController : ControllerBase { if (meta == null) { throw new ArgumentNullException(nameof(meta), "Metadata delegate cannot be null."); } AssertControllerMeetsConstraints(typeof(TController)); var resourceLinkMeta = new ResourceLinkMeta <TController, TResource>(); meta(resourceLinkMeta); AddLinks(resourceLinkMeta.GetResourceLinks()); return((TResourceMeta)this); }