3 writes to IsOptional
Microsoft.AspNetCore.Http.RequestDelegateGenerator (3)
StaticRouteHandlerModel\EndpointParameter.cs (3)
24
IsOptional
= parameter.IsOptional();
34
IsOptional
= property.IsOptional() || parameter?.IsOptional() == true;
144
IsOptional
= isOptional;
24 references to IsOptional
Microsoft.AspNetCore.Http.RequestDelegateGenerator (24)
StaticRouteHandlerModel\Emitters\EmitterExtensions.cs (2)
40
EndpointParameterSource.JsonBody or EndpointParameterSource.Route or EndpointParameterSource.RouteOrQuery or EndpointParameterSource.JsonBodyOrService or EndpointParameterSource.FormBody => endpointParameter.
IsOptional
? endpointParameter.EmitHandlerArgument() : $"{endpointParameter.EmitHandlerArgument()}!",
43
EndpointParameterSource.BindAsync => endpointParameter.
IsOptional
?
StaticRouteHandlerModel\Emitters\EndpointParameterEmitter.cs (13)
34
else if (endpointParameter.
IsOptional
)
78
if (!endpointParameter.
IsOptional
&& !endpointParameter.IsArray)
137
if (endpointParameter.
IsOptional
|| endpointParameter.Type.NullableAnnotation == NullableAnnotation.Annotated)
204
if (!endpointParameter.
IsOptional
)
228
else if (endpointParameter.
IsOptional
)
256
var assigningCode = $"await GeneratedRouteBuilderExtensionsCore.TryResolveBodyAsync<{endpointParameter.Type.ToDisplayString(EmitterConstants.DisplayFormat)}>(httpContext, logOrThrowExceptionHelper, {(endpointParameter.
IsOptional
? "true" : "false")}, {SymbolDisplay.FormatLiteral(shortParameterTypeName, true)}, {SymbolDisplay.FormatLiteral(endpointParameter.SymbolName, true)}, {endpointParameter.SymbolName}_JsonTypeInfo)";
278
var assigningCode = $"await {endpointParameter.SymbolName}_JsonBodyOrServiceResolver(httpContext, {(endpointParameter.
IsOptional
? "true" : "false")})";
292
codeWriter.WriteLine(!endpointParameter.
IsOptional
317
var assigningCode = $"await GeneratedRouteBuilderExtensionsCore.TryResolveBodyAsync<{endpointParameter.Type.ToDisplayString(EmitterConstants.DisplayFormat)}>(httpContext, logOrThrowExceptionHelper, {(endpointParameter.
IsOptional
? "true" : "false")}, {SymbolDisplay.FormatLiteral(shortParameterTypeName, true)}, {SymbolDisplay.FormatLiteral(endpointParameter.SymbolName, true)}, {endpointParameter.SymbolName}_JsonTypeInfo)";
365
if (!endpointParameter.
IsOptional
)
391
var assigningCode = endpointParameter.
IsOptional
?
406
var assigningCode = endpointParameter.
IsOptional
?
419
private static string EmitParameterDiagnosticComment(this EndpointParameter endpointParameter) => $"// Endpoint Parameter: {endpointParameter.SymbolName} (Type = {endpointParameter.Type}, IsOptional = {endpointParameter.
IsOptional
}, IsParsable = {endpointParameter.IsParsable}, IsArray = {endpointParameter.IsArray}, Source = {endpointParameter.Source})";
StaticRouteHandlerModel\EndpointParameter.cs (5)
47
? $"new PropertyAsParameterInfo({(
IsOptional
? "true" : "false")}, {propertyInfo}, {parameter.GetParameterInfoFromConstructorCode()})"
48
: $"new PropertyAsParameterInfo({(
IsOptional
? "true" : "false")}, {propertyInfo})";
165
if (
IsOptional
)
593
other.
IsOptional
==
IsOptional
&&
StaticRouteHandlerModel\StaticRouteHandlerModel.Emitter.cs (4)
40
var isOptional = p.
IsOptional
|| type.NullableAnnotation == NullableAnnotation.Annotated;
320
codeWriter.WriteLine($$"""options.EndpointBuilder.Metadata.Add(new AcceptsMetadata(type: typeof({{explicitBodyParameter.Type.ToDisplayString(EmitterConstants.DisplayFormatWithoutNullability)}}), isOptional: {{(explicitBodyParameter.
IsOptional
? "true" : "false")}}, contentTypes: GeneratedMetadataConstants.JsonContentType));""");
332
codeWriter.WriteLine($$"""({{(parameter.
IsOptional
? "true" : "false")}}, typeof({{parameter.Type.ToDisplayString(EmitterConstants.DisplayFormatWithoutNullability)}})),""");
397
var isOptional = parameter.
IsOptional
? "true" : "false";