public MappingDescription(MethodInfo routeHandler, IRouteDetails routeDetails) { if (routeHandler == null) { throw new ArgumentNullException(nameof(routeHandler)); } if (routeDetails == null) { throw new ArgumentNullException(nameof(routeDetails)); } Predicate = CreatePredicateString(routeDetails); Handler = CreateHandlerString(routeHandler); }
private string CreatePredicateString(IRouteDetails routeDetails) { StringBuilder sb = new StringBuilder("{"); sb.Append("[" + routeDetails.RouteTemplate + "]"); sb.Append(",methods="); sb.Append("[" + CreateRouteMethods(routeDetails.HttpMethods) + "]"); if (!IsEmpty(routeDetails.Produces)) { sb.Append(",produces="); sb.Append("[" + string.Join(" || ", routeDetails.Produces) + "]"); } if (!IsEmpty(routeDetails.Consumes)) { sb.Append(",consumes="); sb.Append("[" + string.Join(" || ", routeDetails.Consumes) + "]"); } sb.Append("}"); return(sb.ToString()); }