25 references to EmitterConstants
Microsoft.AspNetCore.Http.RequestDelegateGenerator (25)
StaticRouteHandlerModel\Emitters\EndpointEmitter.cs (1)
121
codeWriter.WriteLine($"ResolveJsonBodyOrService<{parameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat)}>(logOrThrowExceptionHelper, {SymbolDisplay.FormatLiteral(shortParameterTypeName, true)}, {SymbolDisplay.FormatLiteral(parameter.SymbolName, true)}, jsonSerializerOptions, serviceProviderIsService);");
StaticRouteHandlerModel\Emitters\EndpointJsonPreparationEmitter.cs (4)
18
var typeName = responseType.ToDisplayString(
EmitterConstants
.DisplayFormatWithoutNullability);
19
codeWriter.WriteLine($"var responseJsonTypeInfo = (JsonTypeInfo<{responseType.ToDisplayString(NullableFlowState.MaybeNull,
EmitterConstants
.DisplayFormat)}>)jsonSerializerOptions.GetTypeInfo(typeof({typeName}));");
40
var typeName = parameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat);
41
codeWriter.WriteLine($"var {parameter.SymbolName}_JsonTypeInfo = (JsonTypeInfo<{typeName}>)jsonSerializerOptions.GetTypeInfo(typeof({parameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormatWithoutNullability)}));");
StaticRouteHandlerModel\Emitters\EndpointParameterEmitter.cs (12)
95
var createArray = $"new {endpointParameter.ElementType.ToDisplayString(
EmitterConstants
.DisplayFormat)}[{endpointParameter.EmitTempArgument()}.Length]";
98
codeWriter.WriteLine($"{endpointParameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat)} {endpointParameter.EmitHandlerArgument()} = {createArray};");
141
codeWriter.WriteLine($"""{endpointParameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat)} {output_argument} = default;""");
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)";
304
codeWriter.WriteLine($"{endpointParameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat)} {endpointParameter.EmitHandlerArgument()} = null!;");
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)";
319
codeWriter.WriteLine($"var {endpointParameter.SymbolName}_JsonTypeInfo = (JsonTypeInfo<{endpointParameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat)}>)jsonOptions.SerializerOptions.GetTypeInfo(typeof({endpointParameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormatWithoutNullability)}));");
392
$"httpContext.RequestServices.GetService<{endpointParameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat)}>();" :
393
$"httpContext.RequestServices.GetRequiredService<{endpointParameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat)}>()";
407
$"httpContext.RequestServices.GetKeyedService<{endpointParameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat)}>({endpointParameter.KeyedServiceKey});" :
408
$"httpContext.RequestServices.GetRequiredKeyedService<{endpointParameter.Type.ToDisplayString(
EmitterConstants
.DisplayFormat)}>({endpointParameter.KeyedServiceKey})";
StaticRouteHandlerModel\EndpointResponse.cs (1)
32
WrappedResponseTypeDisplayName = method.ReturnType.ToDisplayString(
EmitterConstants
.DisplayFormat);
StaticRouteHandlerModel\StaticRouteHandlerModel.Emitter.cs (7)
41
return type.ToDisplayString(isOptional ? NullableFlowState.MaybeNull : NullableFlowState.NotNull,
EmitterConstants
.DisplayFormat);
224
codeWriter.WriteLine($$"""options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, type: typeof({{responseType.ToDisplayString(
EmitterConstants
.DisplayFormatWithoutNullability)}}), contentTypes: GeneratedMetadataConstants.JsonContentType));""");
237
codeWriter.WriteLine($"PopulateMetadataForEndpoint<{responseType.ToDisplayString(
EmitterConstants
.DisplayFormat)}>(methodInfo, options.EndpointBuilder);");
275
codeWriter.WriteLine($"PopulateMetadataForParameter<{parameterType.ToDisplayString(
EmitterConstants
.DisplayFormat)}>({parameter.SymbolName}_ParameterInfo, options.EndpointBuilder);");
280
codeWriter.WriteLine($"PopulateMetadataForEndpoint<{parameterType.ToDisplayString(
EmitterConstants
.DisplayFormat)}>(methodInfo, options.EndpointBuilder);");
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)}})),""");