Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ internal static void EmitServiceParameterPreparation(this EndpointParameter endp
// Unlike other scenarios, this will result in an exception being thrown
// at runtime.
var assigningCode = endpointParameter.IsOptional ?
$"httpContext.RequestServices.GetService<{endpointParameter.Type}>();" :
$"httpContext.RequestServices.GetRequiredService<{endpointParameter.Type}>()";
$"httpContext.RequestServices.GetService<{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>();" :
$"httpContext.RequestServices.GetRequiredService<{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>()";
codeWriter.WriteLine($"var {endpointParameter.EmitHandlerArgument()} = {assigningCode};");
}

Expand All @@ -404,8 +404,8 @@ internal static void EmitKeyedServiceParameterPreparation(this EndpointParameter
codeWriter.EndBlock();

var assigningCode = endpointParameter.IsOptional ?
$"httpContext.RequestServices.GetKeyedService<{endpointParameter.Type}>({endpointParameter.KeyedServiceKey});" :
$"httpContext.RequestServices.GetRequiredKeyedService<{endpointParameter.Type}>({endpointParameter.KeyedServiceKey})";
$"httpContext.RequestServices.GetKeyedService<{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>({endpointParameter.KeyedServiceKey});" :
$"httpContext.RequestServices.GetRequiredKeyedService<{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>({endpointParameter.KeyedServiceKey})";
codeWriter.WriteLine($"var {endpointParameter.EmitHandlerArgument()} = {assigningCode};");
}

Expand Down
Loading