コード例 #1
0
        public virtual void Skipped(ILinksRequirement requirement, LinkRequirementSkipReason reason = LinkRequirementSkipReason.Custom, string message = null)
        {
            var username = User?.Identity?.Name ?? "Unknown";

            Logger.LogInformation("Link {Requirement} skipped for user {User}. Reason: {LinkSkipReason}. {Message}.", requirement, username, reason, message ?? String.Empty);
            pendingRequirements.Remove(requirement);
        }
コード例 #2
0
            private Link CreateLink(ILinksRequirement option, string method, object routeValues)
            {
                var url  = _urlHelper.Link(option.Name, routeValues).ToLower();
                var link = new Link(option.Name, url, method);

                return(link);
            }
コード例 #3
0
        public static Task AddLinksAsync <T>(this ILinksService service, T linkContainer, ILinksRequirement requirement) where T : ILinkContainer
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }
            if (requirement == null)
            {
                throw new ArgumentNullException(nameof(requirement));
            }

            return(service.AddLinksAsync(linkContainer, new[] { requirement }));
        }
コード例 #4
0
        private HateoasOptions Add(ILinksRequirement req)
        {
            _links.Add(req);

            return(this);
        }
コード例 #5
0
 public virtual void Handled(ILinksRequirement requirement)
 {
     pendingRequirements.Remove(requirement);
 }