16 references to ParsabilityMethod
Microsoft.AspNetCore.Http.RequestDelegateGenerator (16)
src\Shared\RoslynUtils\ParsabilityHelper.cs (9)
21
private static readonly BoundedCacheWithFactory<ITypeSymbol, (Parsability,
ParsabilityMethod
?)> ParsabilityCache = new();
23
private static bool IsTypeAlwaysParsable(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, [NotNullWhen(true)] out
ParsabilityMethod
? parsabilityMethod)
28
parsabilityMethod =
ParsabilityMethod
.Enum;
35
parsabilityMethod =
ParsabilityMethod
.Uri;
42
parsabilityMethod =
ParsabilityMethod
.String;
55
internal static Parsability GetParsability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, [NotNullWhen(false)] out
ParsabilityMethod
? parsabilityMethod)
70
return (Parsability.Parsable,
ParsabilityMethod
.IParsable);
80
return (Parsability.Parsable,
ParsabilityMethod
.TryParseWithFormatProvider);
85
return (Parsability.Parsable,
ParsabilityMethod
.TryParse);
StaticRouteHandlerModel\EndpointParameter.cs (7)
343
ParsabilityMethod
.IParsable => (string inputArgument, string outputArgument) => $$"""GeneratedRouteBuilderExtensionsCore.TryParseExplicit<{{parameterType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}}>({{inputArgument}}!, CultureInfo.InvariantCulture, out var {{outputArgument}})""",
344
ParsabilityMethod
.TryParseWithFormatProvider => (string inputArgument, string outputArgument) => $$"""{{parameterType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}}.TryParse({{inputArgument}}!, CultureInfo.InvariantCulture, out var {{outputArgument}})""",
345
ParsabilityMethod
.TryParse => (string inputArgument, string outputArgument) => $$"""{{parameterType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}}.TryParse({{inputArgument}}!, out var {{outputArgument}})""",
346
ParsabilityMethod
.Enum => (string inputArgument, string outputArgument) => $$"""Enum.TryParse<{{parameterType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}}>({{inputArgument}}!, out var {{outputArgument}})""",
347
ParsabilityMethod
.Uri => (string inputArgument, string outputArgument) => $$"""Uri.TryCreate({{inputArgument}}!, UriKind.RelativeOrAbsolute, out var {{outputArgument}})""",
348
ParsabilityMethod
.String => null, // string parameters don't require parsing
349
_ => throw new NotImplementedException($"Unreachable! Unexpected {nameof(
ParsabilityMethod
)}: {parsabilityMethod}"),