public static string FriendlyId2(this ApiDescription apiDescription) { var parts = (apiDescription.HttpMethod.ToString().ToLower() + "/" + apiDescription.RelativePathSansQueryString()) .Split('/'); var builder = new StringBuilder(); builder.Append(apiDescription.ControllerName() + "_"); foreach (var part in parts) { var trimmed = part.Trim('{', '}'); builder.AppendFormat("{0}{1}", (part.StartsWith("{") ? "By" : string.Empty), trimmed.ToTitleCase() ); } return(builder.ToString()); }
public static string FriendlyId(this ApiDescription apiDescription) { return(String.Format("{0}_{1}", apiDescription.ControllerName(), apiDescription.ActionDescriptor.ActionName)); }