public static string GetSetParamDefinition(GeneratorParam p) { var name = p.ParamName; if (name == null) { name = "null"; } else { name = $"\"{name}\""; } var value = p.VarName; if (p.Format != null) { return($@"var {value}_fmt = {value} as IFormattable; if ({value}_fmt == null) {{ SetParam({name}, {value}, HttpParamLocation.{p.Location.ToString()}); }} else {{ SetParam({name}, {value}_fmt.ToString(""{p.Format}"", null), HttpParamLocation.{p.Location.ToString()}); }}"); } return($@"SetParam({name}, {value}, HttpParamLocation.{p.Location.ToString()});"); }
public static string GetRemoveParamDefinition(GeneratorParam p) { var name = p.ParamName; if (name == null) { name = "null"; } else { name = $"\"{name}\""; } return($@"SetParam({name}, null, HttpParamLocation.{p.Location.ToString()})"); }
public static string GetMethodArgumentDefinition(GeneratorParam p) { return($"{p.ParamType.GetFriendlyName()} {p.VarName}"); }