public static LinksPolicyBuilder <TResource> RequireSelfLink <TResource>(this LinksPolicyBuilder <TResource> builder, string id) { return(builder.Requires(new SelfLinkRequirement <TResource>() { Id = id })); }
private static LinksPolicyBuilder <TResource> RequiresPagingLinks <TResource>(this LinksPolicyBuilder <TResource> builder, string currentId, string nextId, string previousId, LinkCondition <TResource> condition) { var req = new PagingLinksRequirement <TResource>() { CurrentId = currentId, NextId = nextId, PreviousId = previousId, Condition = condition ?? LinkCondition <TResource> .None }; return(builder.Requires(req)); }
public static LinksPolicyBuilder <TResource> RequireRoutedLink <TResource>(this LinksPolicyBuilder <TResource> builder, string id, string routeName, Func <TResource, object> getValues, LinkCondition <TResource> condition = null) { Func <TResource, RouteValueDictionary> getRouteValues = r => new RouteValueDictionary(); if (getValues != null) { getRouteValues = r => new RouteValueDictionary(getValues(r)); } var req = new RouteLinkRequirement <TResource>() { Id = id, RouteName = routeName, GetRouteValues = getRouteValues, Condition = condition ?? LinkCondition <TResource> .None }; return(builder.Requires(req)); }