|
|
@@ -8,332 +8,15 @@
|
|
|
//------------------------------------------------------------------------------
|
|
|
#nullable enable
|
|
|
|
|
|
-namespace Microsoft.AspNetCore.Builder
|
|
|
+namespace System.Runtime.CompilerServices
|
|
|
{
|
|
|
%GENERATEDCODEATTRIBUTE%
|
|
|
- internal sealed class SourceKey
|
|
|
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
|
|
+ file sealed class InterceptsLocationAttribute : Attribute
|
|
|
{
|
|
|
- public string Path { get; init; }
|
|
|
- public int Line { get; init; }
|
|
|
-
|
|
|
- public SourceKey(string path, int line)
|
|
|
- {
|
|
|
- Path = path;
|
|
|
- Line = line;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // This class needs to be internal so that the compiled application
|
|
|
- // has access to the strongly-typed endpoint definitions that are
|
|
|
- // generated by the compiler so that they will be favored by
|
|
|
- // overload resolution and opt the runtime in to the code generated
|
|
|
- // implementation produced here.
|
|
|
- %GENERATEDCODEATTRIBUTE%
|
|
|
- internal static class GenerateRouteBuilderEndpoints
|
|
|
- {
|
|
|
- private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get };
|
|
|
-
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
- {
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
- }
|
|
|
- internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet(
|
|
|
- this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,
|
|
|
- [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern,
|
|
|
- global::System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?, global::System.String> handler,
|
|
|
- [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "",
|
|
|
- [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)
|
|
|
+ public InterceptsLocationAttribute(string filePath, int line, int column)
|
|
|
{
|
|
|
- return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore(
|
|
|
- endpoints,
|
|
|
- pattern,
|
|
|
- handler,
|
|
|
- GetVerb,
|
|
|
- filePath,
|
|
|
- lineNumber);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -348,6 +31,7 @@ namespace Microsoft.AspNetCore.Http.Generated
|
|
|
using System.Globalization;
|
|
|
using System.Linq;
|
|
|
using System.Reflection;
|
|
|
+ using System.Runtime.CompilerServices;
|
|
|
using System.Text.Json;
|
|
|
using System.Text.Json.Serialization.Metadata;
|
|
|
using System.Threading.Tasks;
|
|
|
@@ -370,1856 +54,2138 @@ namespace Microsoft.AspNetCore.Http.Generated
|
|
|
%GENERATEDCODEATTRIBUTE%
|
|
|
file static class GeneratedRouteBuilderExtensionsCore
|
|
|
{
|
|
|
+ private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get };
|
|
|
|
|
|
- private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new()
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 25, 13)]
|
|
|
+ internal static RouteHandlerBuilder MapGet0(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
{
|
|
|
- [(@"TestMapActions.cs", 25)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 25));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord.BindAsync(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncRecord", "myBindAsyncParam", "MyBindAsyncRecord.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord)myBindAsyncParam_temp;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord.BindAsync(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncRecord", "myBindAsyncParam", "MyBindAsyncRecord.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ else
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord.BindAsync(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncRecord", "myBindAsyncParam", "MyBindAsyncRecord.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
}
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 26)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 26));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord.BindAsync(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncRecord", "myBindAsyncParam", "MyBindAsyncRecord.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ else
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord.BindAsync(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord)myBindAsyncParam_temp;
|
|
|
}
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord.BindAsync(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
}
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 27)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 27));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 26, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet1(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncStruct", "myBindAsyncParam", "MyBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
- }
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord.BindAsync(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncStruct", "myBindAsyncParam", "MyBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
}
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 28)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 28));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord.BindAsync(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncRecord?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 29)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 29));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 27, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet2(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyNullableBindAsyncStruct", "myBindAsyncParam", "MyNullableBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncStruct", "myBindAsyncParam", "MyBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ else
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyNullableBindAsyncStruct", "myBindAsyncParam", "MyNullableBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 30)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 30));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncStruct", "myBindAsyncParam", "MyBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
}
|
|
|
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 28, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet3(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
}
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncStruct?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 29, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet4(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyNullableBindAsyncStruct", "myBindAsyncParam", "MyNullableBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
}
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 31)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 31));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyNullableBindAsyncStruct", "myBindAsyncParam", "MyNullableBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 30, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet5(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBothBindAsyncStruct", "myBindAsyncParam", "MyBothBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
}
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBothBindAsyncStruct", "myBindAsyncParam", "MyBothBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyNullableBindAsyncStruct?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 31, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet6(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
- }
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 32)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 32));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBothBindAsyncStruct", "myBindAsyncParam", "MyBothBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct.BindAsync(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBothBindAsyncStruct", "myBindAsyncParam", "MyBothBindAsyncStruct.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
}
|
|
|
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 32, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet7(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
}
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct.BindAsync(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBothBindAsyncStruct?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 33, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet8(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord.BindAsync(httpContext);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MySimpleBindAsyncRecord", "myBindAsyncParam", "MySimpleBindAsyncRecord.BindAsync(HttpContext)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 33)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 33));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord.BindAsync(httpContext);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MySimpleBindAsyncRecord", "myBindAsyncParam", "MySimpleBindAsyncRecord.BindAsync(HttpContext)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 34, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet9(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord.BindAsync(httpContext);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MySimpleBindAsyncRecord", "myBindAsyncParam", "MySimpleBindAsyncRecord.BindAsync(HttpContext)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord)myBindAsyncParam_temp;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord.BindAsync(httpContext);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?)myBindAsyncParam_temp;
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
}
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord.BindAsync(httpContext);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?)myBindAsyncParam_temp;
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord.BindAsync(httpContext);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MySimpleBindAsyncRecord", "myBindAsyncParam", "MySimpleBindAsyncRecord.BindAsync(HttpContext)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 35, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet10(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
- }
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 34)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 34));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct.BindAsync(httpContext);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MySimpleBindAsyncStruct", "myBindAsyncParam", "MySimpleBindAsyncStruct.BindAsync(HttpContext)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct.BindAsync(httpContext);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MySimpleBindAsyncStruct", "myBindAsyncParam", "MySimpleBindAsyncStruct.BindAsync(HttpContext)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
}
|
|
|
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord.BindAsync(httpContext);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?)myBindAsyncParam_temp;
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 36, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet11(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct.BindAsync(httpContext);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct.BindAsync(httpContext);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord.BindAsync(httpContext);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?)myBindAsyncParam_temp;
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncRecord?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 37, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet12(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("BindAsyncFromImplicitStaticAbstractInterface", "myBindAsyncParam", "BindAsyncFromImplicitStaticAbstractInterface.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface)myBindAsyncParam_temp;
|
|
|
}
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 35)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 35));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("BindAsyncFromImplicitStaticAbstractInterface", "myBindAsyncParam", "BindAsyncFromImplicitStaticAbstractInterface.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 38, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet13(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct.BindAsync(httpContext);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MySimpleBindAsyncStruct", "myBindAsyncParam", "MySimpleBindAsyncStruct.BindAsync(HttpContext)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?)myBindAsyncParam_temp;
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct.BindAsync(httpContext);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MySimpleBindAsyncStruct", "myBindAsyncParam", "MySimpleBindAsyncStruct.BindAsync(HttpContext)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 39, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet14(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync.BindAsync(httpContext);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("InheritBindAsync", "myBindAsyncParam", "InheritBindAsync.BindAsync(HttpContext)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync.BindAsync(httpContext);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("InheritBindAsync", "myBindAsyncParam", "InheritBindAsync.BindAsync(HttpContext)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 40, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet15(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
- }
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 36)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 36));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync.BindAsync(httpContext);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct.BindAsync(httpContext);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct.BindAsync(httpContext);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MySimpleBindAsyncStruct?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
}
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 37)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 37));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("BindAsyncFromImplicitStaticAbstractInterface", "myBindAsyncParam", "BindAsyncFromImplicitStaticAbstractInterface.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync.BindAsync(httpContext);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?)myBindAsyncParam_temp;
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("BindAsyncFromImplicitStaticAbstractInterface", "myBindAsyncParam", "BindAsyncFromImplicitStaticAbstractInterface.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 41, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet16(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
- }
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 38)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 38));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("BindAsyncFromExplicitStaticAbstractInterface", "myBindAsyncParam", "BindAsyncFromExplicitStaticAbstractInterface.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ else
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface)myBindAsyncParam_temp;
|
|
|
}
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface>(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromImplicitStaticAbstractInterface?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
}
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 39)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 39));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync.BindAsync(httpContext);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("InheritBindAsync", "myBindAsyncParam", "InheritBindAsync.BindAsync(HttpContext)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, parameters[1]);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("BindAsyncFromExplicitStaticAbstractInterface", "myBindAsyncParam", "BindAsyncFromExplicitStaticAbstractInterface.BindAsync(HttpContext, ParameterInfo)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 42, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet17(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+ var parameters = del.Method.GetParameters();
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
+ {
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync.BindAsync(httpContext);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("InheritBindAsync", "myBindAsyncParam", "InheritBindAsync.BindAsync(HttpContext)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync)myBindAsyncParam_temp;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?)myBindAsyncParam_temp;
|
|
|
+
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
}
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 40)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 40));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, parameters[0]);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync.BindAsync(httpContext);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync.BindAsync(httpContext);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.InheritBindAsync?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 41)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 41));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 43, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet18(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.HttpContext arg0, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord arg1) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("BindAsyncFromExplicitStaticAbstractInterface", "myBindAsyncParam", "BindAsyncFromExplicitStaticAbstractInterface.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface)myBindAsyncParam_temp;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>(1)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.IBindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>.BindAsync(httpContext);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncFromInterfaceRecord", "myBindAsyncParam", "MyBindAsyncFromInterfaceRecord.BindAsync(HttpContext)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ else
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, parameters[1]);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("BindAsyncFromExplicitStaticAbstractInterface", "myBindAsyncParam", "BindAsyncFromExplicitStaticAbstractInterface.BindAsync(HttpContext, ParameterInfo)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord)myBindAsyncParam_temp;
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ if (wasParamCheckFailure)
|
|
|
+ {
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
}
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 42)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 42));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
- var parameters = del.Method.GetParameters();
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var httpContext_local = httpContext;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.IBindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>.BindAsync(httpContext);
|
|
|
+ global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord myBindAsyncParam_local;
|
|
|
+ if ((object?)myBindAsyncParam_temp == null)
|
|
|
+ {
|
|
|
+ logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncFromInterfaceRecord", "myBindAsyncParam", "MyBindAsyncFromInterfaceRecord.BindAsync(HttpContext)");
|
|
|
+ wasParamCheckFailure = true;
|
|
|
+ myBindAsyncParam_local = default!;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ else
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord)myBindAsyncParam_temp;
|
|
|
}
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await BindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface>(httpContext, parameters[0]);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.BindAsyncFromExplicitStaticAbstractInterface?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ }
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
+ {
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 43)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 43));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
+
|
|
|
+ [InterceptsLocation(@"TestMapActions.cs", 44, 5)]
|
|
|
+ internal static RouteHandlerBuilder MapGet19(
|
|
|
+ this IEndpointRouteBuilder endpoints,
|
|
|
+ [StringSyntax("Route")] string pattern,
|
|
|
+ Delegate handler)
|
|
|
+ {
|
|
|
+ MetadataPopulator populateMetadata = (methodInfo, options) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ options.EndpointBuilder.Metadata.Add(new System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.RequestDelegateGenerator, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42"));
|
|
|
+ options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
+ return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
+ };
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate = (del, options, inferredMetadataResult) =>
|
|
|
+ {
|
|
|
+ Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
+ Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
+ var handler = Cast(del, global::System.String (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord? arg0) => throw null!);
|
|
|
+ EndpointFilterDelegate? filteredInvocation = null;
|
|
|
+ var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
+ var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
+ var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
+ var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
+
|
|
|
+ if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>(1)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
-
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
- {
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.IBindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>.BindAsync(httpContext);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncFromInterfaceRecord", "myBindAsyncParam", "MyBindAsyncFromInterfaceRecord.BindAsync(HttpContext)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
+ filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
+ {
|
|
|
+ if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
{
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord)myBindAsyncParam_temp;
|
|
|
+ return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
}
|
|
|
+ return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?>(0)!));
|
|
|
+ },
|
|
|
+ options.EndpointBuilder,
|
|
|
+ handler.Method);
|
|
|
+ }
|
|
|
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(httpContext_local, myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
- }
|
|
|
+ async Task RequestHandler(HttpContext httpContext)
|
|
|
+ {
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.IBindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>.BindAsync(httpContext);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var httpContext_local = httpContext;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.IBindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>.BindAsync(httpContext);
|
|
|
- global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord myBindAsyncParam_local;
|
|
|
- if ((object?)myBindAsyncParam_temp == null)
|
|
|
- {
|
|
|
- logOrThrowExceptionHelper.RequiredParameterNotProvided("MyBindAsyncFromInterfaceRecord", "myBindAsyncParam", "MyBindAsyncFromInterfaceRecord.BindAsync(HttpContext)");
|
|
|
- wasParamCheckFailure = true;
|
|
|
- myBindAsyncParam_local = default!;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord)myBindAsyncParam_temp;
|
|
|
- }
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.HttpContext, global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>(httpContext, httpContext_local, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var result = handler(myBindAsyncParam_local);
|
|
|
+ if (result is string)
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
+ }
|
|
|
+ await httpContext.Response.WriteAsync(result);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
- [(@"TestMapActions.cs", 44)] = (
|
|
|
- (methodInfo, options) =>
|
|
|
+ async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
{
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 44));
|
|
|
- options.EndpointBuilder.Metadata.Add(new ProducesResponseTypeMetadata(statusCode: StatusCodes.Status200OK, contentTypes: GeneratedMetadataConstants.PlaintextContentType));
|
|
|
- return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() };
|
|
|
- },
|
|
|
- (del, options, inferredMetadataResult) =>
|
|
|
- {
|
|
|
- Debug.Assert(options != null, "RequestDelegateFactoryOptions not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found.");
|
|
|
- Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
|
|
|
- var handler = (System.Func<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?, global::System.String>)del;
|
|
|
- EndpointFilterDelegate? filteredInvocation = null;
|
|
|
- var serviceProvider = options.ServiceProvider ?? options.EndpointBuilder.ApplicationServices;
|
|
|
- var logOrThrowExceptionHelper = new LogOrThrowExceptionHelper(serviceProvider, options);
|
|
|
- var jsonOptions = serviceProvider?.GetService<IOptions<JsonOptions>>()?.Value ?? new JsonOptions();
|
|
|
- var objectJsonTypeInfo = (JsonTypeInfo<object?>)jsonOptions.SerializerOptions.GetTypeInfo(typeof(object));
|
|
|
-
|
|
|
- if (options.EndpointBuilder.FilterFactories.Count > 0)
|
|
|
- {
|
|
|
- filteredInvocation = GeneratedRouteBuilderExtensionsCore.BuildFilterDelegate(ic =>
|
|
|
- {
|
|
|
- if (ic.HttpContext.Response.StatusCode == 400)
|
|
|
- {
|
|
|
- return ValueTask.FromResult<object?>(Results.Empty);
|
|
|
- }
|
|
|
- return ValueTask.FromResult<object?>(handler(ic.GetArgument<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?>(0)!));
|
|
|
- },
|
|
|
- options.EndpointBuilder,
|
|
|
- handler.Method);
|
|
|
- }
|
|
|
+ var wasParamCheckFailure = false;
|
|
|
+ var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.IBindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>.BindAsync(httpContext);
|
|
|
+ var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?)myBindAsyncParam_temp;
|
|
|
|
|
|
- async Task RequestHandler(HttpContext httpContext)
|
|
|
+ if (wasParamCheckFailure)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.IBindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>.BindAsync(httpContext);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- return;
|
|
|
- }
|
|
|
- var result = handler(myBindAsyncParam_local);
|
|
|
- if (result is string)
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "text/plain; charset=utf-8";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- httpContext.Response.ContentType ??= "application/json; charset=utf-8";
|
|
|
- }
|
|
|
- await httpContext.Response.WriteAsync(result);
|
|
|
+ httpContext.Response.StatusCode = 400;
|
|
|
}
|
|
|
-
|
|
|
- async Task RequestHandlerFiltered(HttpContext httpContext)
|
|
|
+ var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?>(httpContext, myBindAsyncParam_local));
|
|
|
+ if (result is not null)
|
|
|
{
|
|
|
- var wasParamCheckFailure = false;
|
|
|
- var myBindAsyncParam_temp = await global::Microsoft.AspNetCore.Http.Generators.Tests.IBindAsync<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord>.BindAsync(httpContext);
|
|
|
- var myBindAsyncParam_local = (global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?)myBindAsyncParam_temp;
|
|
|
-
|
|
|
- if (wasParamCheckFailure)
|
|
|
- {
|
|
|
- httpContext.Response.StatusCode = 400;
|
|
|
- }
|
|
|
- var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::Microsoft.AspNetCore.Http.Generators.Tests.MyBindAsyncFromInterfaceRecord?>(httpContext, myBindAsyncParam_local));
|
|
|
- if (result is not null)
|
|
|
- {
|
|
|
- await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
- }
|
|
|
+ await GeneratedRouteBuilderExtensionsCore.ExecuteReturnAsync(result, httpContext, objectJsonTypeInfo);
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
+ var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
+ return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
+ };
|
|
|
+ return MapCore(
|
|
|
+ endpoints,
|
|
|
+ pattern,
|
|
|
+ handler,
|
|
|
+ GetVerb,
|
|
|
+ populateMetadata,
|
|
|
+ createRequestDelegate);
|
|
|
+ }
|
|
|
|
|
|
- RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered;
|
|
|
- var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection<object>.Empty;
|
|
|
- return new RequestDelegateResult(targetDelegate, metadata);
|
|
|
- }),
|
|
|
|
|
|
- };
|
|
|
|
|
|
internal static RouteHandlerBuilder MapCore(
|
|
|
this IEndpointRouteBuilder routes,
|
|
|
string pattern,
|
|
|
Delegate handler,
|
|
|
IEnumerable<string>? httpMethods,
|
|
|
- string filePath,
|
|
|
- int lineNumber)
|
|
|
+ MetadataPopulator populateMetadata,
|
|
|
+ RequestDelegateFactoryFunc createRequestDelegate)
|
|
|
{
|
|
|
- var (populateMetadata, createRequestDelegate) = map[(filePath, lineNumber)];
|
|
|
return RouteHandlerServices.Map(routes, pattern, handler, httpMethods, populateMetadata, createRequestDelegate);
|
|
|
}
|
|
|
|
|
|
+ private static T Cast<T>(Delegate d, T _) where T : Delegate
|
|
|
+ {
|
|
|
+ return (T)d;
|
|
|
+ }
|
|
|
+
|
|
|
private static EndpointFilterDelegate BuildFilterDelegate(EndpointFilterDelegate filteredInvocation, EndpointBuilder builder, MethodInfo mi)
|
|
|
{
|
|
|
var routeHandlerFilters = builder.FilterFactories;
|