ServiceStack.Host.RouteNamingConvention.WithMatchingAttributes C# (CSharp) Method

WithMatchingAttributes() public static method

public static WithMatchingAttributes ( IServiceRoutes routes, Type requestType, string allowedVerbs ) : void
routes IServiceRoutes
requestType System.Type
allowedVerbs string
return void
        public static void WithMatchingAttributes(IServiceRoutes routes, Type requestType, string allowedVerbs)
        {
            var membersWithAttribute = (from p in requestType.GetPublicProperties()
                                        let attributes = p.AllAttributes<Attribute>()
                                        where attributes.Any(a => AttributeNamesToMatch.Contains(a.GetType().Name))
                                        select "{{{0}}}".Fmt(p.Name)).ToList();

            if (membersWithAttribute.Count == 0) return;

            membersWithAttribute.Insert(0, "/{0}".Fmt(requestType.Name));

            var restPath = membersWithAttribute.Join("/");
            routes.Add(requestType, restPath: restPath, verbs: allowedVerbs, priority: AutoGenPriority);
        }