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

WithMatchingPropertyNames() public static method

public static WithMatchingPropertyNames ( IServiceRoutes routes, Type requestType, string allowedVerbs ) : void
routes IServiceRoutes
requestType System.Type
allowedVerbs string
return void
        public static void WithMatchingPropertyNames(IServiceRoutes routes, Type requestType, string allowedVerbs)
        {
            var membersWithName = (from property in requestType.GetPublicProperties().Select(p => p.Name)
                                   from name in PropertyNamesToMatch
                                   where property.Equals(name, StringComparison.InvariantCultureIgnoreCase)
                                   select "{{{0}}}".Fmt(property)).ToList();

            if (membersWithName.Count == 0) return;

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

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