mirror of
https://github.com/AlexMacocian/Net.Sdk.Web.Extensions.git
synced 2026-07-15 13:39:29 +00:00
Add support for ValueTask
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Version>0.8.18</Version>
|
<Version>0.8.19</Version>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>Alexandru Macocian</Authors>
|
<Authors>Alexandru Macocian</Authors>
|
||||||
|
|||||||
@@ -262,13 +262,19 @@ public class UseRoutesGenerator : IIncrementalGenerator
|
|||||||
return returnTypeSymbol?.ToDisplayString() switch
|
return returnTypeSymbol?.ToDisplayString() switch
|
||||||
{
|
{
|
||||||
"System.Threading.Tasks.Task<Microsoft.AspNetCore.Http.IResult>" => @$"
|
"System.Threading.Tasks.Task<Microsoft.AspNetCore.Http.IResult>" => @$"
|
||||||
builder.Map{type}(""{pattern}"", (Delegate)((HttpContext httpContext, {classDeclarationSyntax.Identifier} route{(parameters.Length > 0 ? $", {parameters}" : "")}) =>
|
builder.Map{type}(""{pattern}"", (HttpContext httpContext, {classDeclarationSyntax.Identifier} route{(parameters.Length > 0 ? $", {parameters}" : "")}) =>
|
||||||
{{
|
{{
|
||||||
var cancellationToken = httpContext.RequestAborted;
|
var cancellationToken = httpContext.RequestAborted;
|
||||||
return route.{methodDeclarationSyntax.Identifier}({variables});
|
return route.{methodDeclarationSyntax.Identifier}({variables});
|
||||||
}})){routeFilterSb};",
|
}}){routeFilterSb};",
|
||||||
"Microsoft.AspNetCore.Http.IResult" => @$"
|
"Microsoft.AspNetCore.Http.IResult" => @$"
|
||||||
builder.Map{type}(""{pattern}"", (HttpContext httpContext, {classDeclarationSyntax.Identifier} route{(parameters.Length > 0 ? $", {parameters}" : "")}) =>
|
builder.Map{type}(""{pattern}"", (HttpContext httpContext, {classDeclarationSyntax.Identifier} route{(parameters.Length > 0 ? $", {parameters}" : "")}) =>
|
||||||
|
{{
|
||||||
|
var cancellationToken = httpContext.RequestAborted;
|
||||||
|
return route.{methodDeclarationSyntax.Identifier}({variables});
|
||||||
|
}}){routeFilterSb};",
|
||||||
|
"System.Threading.Tasks.ValueTask<Microsoft.AspNetCore.Http.IResult>" => @$"
|
||||||
|
builder.Map{type}(""{pattern}"", (HttpContext httpContext, {classDeclarationSyntax.Identifier} route{(parameters.Length > 0 ? $", {parameters}" : "")}) =>
|
||||||
{{
|
{{
|
||||||
var cancellationToken = httpContext.RequestAborted;
|
var cancellationToken = httpContext.RequestAborted;
|
||||||
return route.{methodDeclarationSyntax.Identifier}({variables});
|
return route.{methodDeclarationSyntax.Identifier}({variables});
|
||||||
|
|||||||
Reference in New Issue
Block a user