private static string WriteRouteConstraint(RouteConstraint constraint)
        {
            if (constraint is AlphaConstraint)
            {
                return($@"
			if(string.IsNullOrWhiteSpace({constraint.ParameterName}) || {constraint.ParameterName}.Any(x=>char.IsNumber(x)))
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} must only contain characters that are not numbers."");
			}}"            );
            }
            else if (constraint is BoolConstraint)
            {
                return($@"
			if(!bool.TryParse({constraint.ParameterName}.ToString(),out _))
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} does not parse into an bool."");
			}}"            );
            }
            else if (constraint is DateTimeConstraint)
            {
                return($@"
			if(!DateTime.TryParse({constraint.ParameterName}.ToString(),out _))
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} does not parse into an DateTime."");
			}}"            );
            }
            else if (constraint is DecimalConstraint)
            {
                return($@"
			if(!decimal.TryParse({constraint.ParameterName}.ToString(),out _))
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} does not parse into an decimal."");
			}}"            );
            }
            else if (constraint is FloatConstraint)
            {
                return($@"
			if(!float.TryParse({constraint.ParameterName}.ToString(),out _))
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} does not parse into an float."");
			}}"            );
            }
            else if (constraint is GuidConstraint)
            {
                return($@"
			if(!Guid.TryParse({constraint.ParameterName}.ToString(),out _))
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} does not parse into an Guid."");
			}}"            );
            }
            else if (constraint is IntConstraint)
            {
                return($@"
			if(!int.TryParse({constraint.ParameterName}.ToString(),out _))
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} does not parse into an int."");
			}}"            );
            }
            else if (constraint is LengthConstraint)
            {
                var value = constraint.GetConstraintValue();
                if (value.Contains(','))
                {
                    var    split = value.Split(',');
                    string minL  = split[0];
                    string maxL  = split[1];

                    return($@"
			if({constraint.ParameterName}.Length <= {minL} || {constraint.ParameterName}.Length >= {maxL})
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} has a length that is not between {minL} and {maxL}."");
			}}"            );
                }
                else
                {
                    return($@"
			if({constraint.ParameterName}.Length == {value})
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} has a length that is not {value}."");
			}}"            );
                }
            }
            else if (constraint is LongConstraint)
            {
                return($@"
			if(!long.TryParse({constraint.ParameterName}.ToString(),out _))
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} does not parse into an long."");
			}}"            );
            }
            else if (constraint is MaxConstraint)
            {
                var value = constraint.GetConstraintValue();

                return($@"
			if({constraint.ParameterName} >= {value})
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} has a value more than {value}."");
			}}"            );
            }
            else if (constraint is MaxLengthConstraint)
            {
                var value = constraint.GetConstraintValue();

                return($@"
			if({constraint.ParameterName}.Length >= {value})
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} has a length greater than {value}."");
			}}"            );
            }
            else if (constraint is MinConstraint)
            {
                var value = constraint.GetConstraintValue();

                return($@"
			if({constraint.ParameterName} <= {value})
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} has a value less than {value}."");
			}}"            );
            }
            else if (constraint is MinLengthConstraint)
            {
                var value = constraint.GetConstraintValue();

                return($@"
			if({constraint.ParameterName}.Length <= {value})
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} has a length less than {value}."");
			}}"            );
            }
            else if (constraint is RangeConstraint)
            {
                var value = constraint.GetConstraintValue();

                var    split = value.Split(',');
                string minL  = split[0];
                string maxL  = split[1];

                return($@"
			if({constraint.ParameterName} <= {minL} || {constraint.ParameterName} >= {maxL})
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} has a value that is not between {minL} and {maxL}."");
			}}"            );
            }
            else if (constraint is RegexConstraint)
            {
                var value = constraint.GetConstraintValue();

                return($@"
			if(!(new Regex(@""{value}"").IsMatch({constraint.ParameterName})))
			{{
				throw new InvalidRouteException(""Parameter {constraint.ParameterName} does not follow the regex \""{value}\""."");
			}}"            );
            }
            else if (constraint is RequiredConstraint)
            {
                return(null);
            }
            else
            {
                return($@"#error A route constraint of type {constraint.GetType().Name} and text of {constraint.Constraint} is not supported");
            }
        }