160 references to RequestDelegateFactory
Microsoft.AspNetCore.Http.Extensions (29)
RequestDelegateFactory.cs (23)
41private static readonly MethodInfo ExecuteTaskWithEmptyResultMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskWithEmptyResult), BindingFlags.NonPublic | BindingFlags.Static)!; 42private static readonly MethodInfo ExecuteValueTaskWithEmptyResultMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskWithEmptyResult), BindingFlags.NonPublic | BindingFlags.Static)!; 43private static readonly MethodInfo ExecuteTaskOfTMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskOfT), BindingFlags.NonPublic | BindingFlags.Static)!; 44private static readonly MethodInfo ExecuteTaskOfTFastMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskOfTFast), BindingFlags.NonPublic | BindingFlags.Static)!; 45private static readonly MethodInfo ExecuteTaskOfObjectMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!; 46private static readonly MethodInfo ExecuteValueTaskOfObjectMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!; 47private static readonly MethodInfo ExecuteTaskOfStringMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskOfString), BindingFlags.NonPublic | BindingFlags.Static)!; 48private static readonly MethodInfo ExecuteValueTaskOfTMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskOfT), BindingFlags.NonPublic | BindingFlags.Static)!; 49private static readonly MethodInfo ExecuteValueTaskOfTFastMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskOfTFast), BindingFlags.NonPublic | BindingFlags.Static)!; 50private static readonly MethodInfo ExecuteValueTaskMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTask), BindingFlags.NonPublic | BindingFlags.Static)!; 51private static readonly MethodInfo ExecuteValueTaskOfStringMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskOfString), BindingFlags.NonPublic | BindingFlags.Static)!; 52private static readonly MethodInfo ExecuteTaskResultOfTMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskResult), BindingFlags.NonPublic | BindingFlags.Static)!; 53private static readonly MethodInfo ExecuteValueResultTaskOfTMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskResult), BindingFlags.NonPublic | BindingFlags.Static)!; 54private static readonly MethodInfo ExecuteAwaitedReturnMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteAwaitedReturn), BindingFlags.NonPublic | BindingFlags.Static)!; 60private static readonly MethodInfo ResultWriteResponseAsyncMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteResultWriteResponse), BindingFlags.NonPublic | BindingFlags.Static)!; 61private static readonly MethodInfo StringResultWriteResponseAsyncMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteWriteStringResponseAsync), BindingFlags.NonPublic | BindingFlags.Static)!; 63private static readonly MethodInfo WrapObjectAsValueTaskMethod = typeof(RequestDelegateFactory).GetMethod(nameof(WrapObjectAsValueTask), BindingFlags.NonPublic | BindingFlags.Static)!; 64private static readonly MethodInfo TaskOfTToValueTaskOfObjectMethod = typeof(RequestDelegateFactory).GetMethod(nameof(TaskOfTToValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!; 65private static readonly MethodInfo ValueTaskOfTToValueTaskOfObjectMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ValueTaskOfTToValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!; 74private static readonly MethodInfo JsonResultWriteResponseOfTFastAsyncMethod = typeof(RequestDelegateFactory).GetMethod(nameof(WriteJsonResponseFast), BindingFlags.NonPublic | BindingFlags.Static)!; 75private static readonly MethodInfo JsonResultWriteResponseOfTAsyncMethod = typeof(RequestDelegateFactory).GetMethod(nameof(WriteJsonResponse), BindingFlags.NonPublic | BindingFlags.Static)!; 123private static readonly MethodInfo ProcessFormMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ProcessForm), BindingFlags.Static | BindingFlags.NonPublic)!; 2839return loggerFactory.CreateLogger(typeof(RequestDelegateFactory));
RequestDelegateFactoryOptions.cs (4)
11/// Options for controlling the behavior of the <see cref="RequestDelegate" /> when created using <see cref="RequestDelegateFactory" />. 32/// Prevent the <see cref="RequestDelegateFactory" /> from inferring a parameter should be bound from the request body without an attribute that implements <see cref="IFromBodyMetadata"/>. 39/// The <see cref="EndpointBuilder.RequestDelegate"/> must be <see langword="null"/>. After the call to <see cref="RequestDelegateFactory.Create(Delegate, RequestDelegateFactoryOptions?)"/>, 46/// <see cref="IAcceptsMetadata"/> that <see cref="RequestDelegateFactory.Create(Delegate, RequestDelegateFactoryOptions?)"/> infers automatically
RequestDelegateMetadataResult.cs (2)
7/// The metadata inferred by <see cref="RequestDelegateFactory.InferMetadata(System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?)"/>. 9/// If this is passed to <see cref="RequestDelegateFactory.Create(Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?)"/>,
Microsoft.AspNetCore.Http.Extensions.Tests (128)
RequestDelegateFactoryTests.cs (118)
106var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions() 138var factoryResult = RequestDelegateFactory.Create(methodInfo!); 184var factoryResult = RequestDelegateFactory.Create(methodInfo!, _ => GetTarget()); 210var exNullAction = Assert.Throws<ArgumentNullException>(() => RequestDelegateFactory.Create(handler: null!)); 211var exNullMethodInfo1 = Assert.Throws<ArgumentNullException>(() => RequestDelegateFactory.Create(methodInfo: null!)); 242var factoryResult = RequestDelegateFactory.Create((int? id, HttpContext httpContext) => 273var factoryResult = RequestDelegateFactory.Create(methodInfo!); 291RequestDelegateFactory.Create(([FromRoute] int id) => { }, new() { RouteParameterNames = Array.Empty<string>() })); 587var factoryResult = RequestDelegateFactory.Create(action); 614var factoryResult = RequestDelegateFactory.Create(StoreNullableIntArray, new() { DisableInferBodyFromParameters = true }); 640var factoryResult = RequestDelegateFactory.Create((HttpContext context, 665var factoryResult = RequestDelegateFactory.Create((HttpContext context, 696var factoryResult = RequestDelegateFactory.Create( 722var resultFactory = RequestDelegateFactory.Create( 757var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(action)); 766var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(lambda.Compile())); 786var factoryResult = RequestDelegateFactory.Create(StoreNullableIntArray, new() { ThrowOnBadRequest = true, DisableInferBodyFromParameters = true }); 900var factoryResult = RequestDelegateFactory.Create(action, new RequestDelegateFactoryOptions() { ServiceProvider = mock.Object }); 919var factoryResult = RequestDelegateFactory.Create(action); 934var ex1 = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(Method1)); 935var ex2 = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(Method2)); 936var ex3 = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(Method3)); 960Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestAttributedInvalidAction)); 961Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestInferredInvalidAction)); 962Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestBothInvalidAction)); 971Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestTryParseStruct)); 972Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestTryParseClass)); 994var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestBindAsyncStruct)); 995Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestBindAsyncClass)); 1049var exception = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(@delegate)); 1059Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestNestedParameterListRecordOnType)); 1060Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestNestedParameterListRecordOnArgument)); 1150var outParamException = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(OutMethod)); 1151var inParamException = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(InMethod)); 1152var refParamException = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(RefMethod)); 1167var factoryResult = RequestDelegateFactory.Create(action); 1189var requestDelegateResult = RequestDelegateFactory.Create(action); 1212var factoryResult = RequestDelegateFactory.Create(action, options: new() { ServiceProvider = services }); 1232var factoryResult = RequestDelegateFactory.Create(TestAction); 1256var factoryResult = RequestDelegateFactory.Create(TestAction); 1277var factoryResult = RequestDelegateFactory.Create(TestAction); 1297var factoryResult = RequestDelegateFactory.Create(TestAction); 1317var factoryResult = RequestDelegateFactory.Create(TestAction); 1377var factoryResult = RequestDelegateFactory.Create(@delegate); 1410var factoryResult = RequestDelegateFactory.Create(@delegate); 1440Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestAction, new() { ServiceProvider = httpContext.RequestServices })); 1506var factoryResult = RequestDelegateFactory.Create(@delegate); 1545var factoryResult = RequestDelegateFactory.Create(@delegate); 1595var factoryResult = RequestDelegateFactory.Create(@delegate, new() 1698var factoryResult = RequestDelegateFactory.Create(routeHandler); 1776var factoryResult = RequestDelegateFactory.Create(@delegate, options); 1811var factoryResult = RequestDelegateFactory.Create(optionalQueryParam); 1841var factoryResult = RequestDelegateFactory.Create(optionalQueryParam); 1871var factoryResult = RequestDelegateFactory.Create(optionalQueryParam); 1898var factoryResult = RequestDelegateFactory.Create(actionWithExtensionsResult); 1938var factoryResult = RequestDelegateFactory.Create(@delegate); 1967var factoryResult = RequestDelegateFactory.Create(TestAction); 2000var factoryResult = RequestDelegateFactory.Create(TestAction); 2031Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFileAndJson)); 2032Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFilesAndJson)); 2033Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFileAndJsonWithAttribute)); 2034Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFileCollectionAndJson)); 2035Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormCollectionAndJson)); 2036Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormWithAttributeAndJson)); 2037Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFile)); 2038Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFiles)); 2039Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFileCollection)); 2040Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFileWithAttribute)); 2041Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormCollection)); 2042Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormWithAttribute)); 2055var nse = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestAction)); 2104var nse = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestAction)); 2141var exception = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(action)); 2154var exception = Assert.Throws<ArgumentException>(() => RequestDelegateFactory.Create(TestAction)); 2194var factoryResult = RequestDelegateFactory.Create(methodInfo!, null, new RequestDelegateFactoryOptions() 2237var factoryResult = RequestDelegateFactory.Create(methodInfo!, targetFactory, new RequestDelegateFactoryOptions() 2309var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions() 2404var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions() 2438var factoryResult = RequestDelegateFactory.Create(HandlerWithTaskAwait, new RequestDelegateFactoryOptions() 2523var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions() 2551var result = RequestDelegateFactory.Create(@delegate); 2562var result = RequestDelegateFactory.Create(@delegate); 2574var result = RequestDelegateFactory.Create(@delegate); 2591var result = RequestDelegateFactory.Create(@delegate, options); 2610var result = RequestDelegateFactory.Create(@delegate); 2624var result = RequestDelegateFactory.Create(@delegate); 2638var result = RequestDelegateFactory.Create(@delegate); 2651var result = RequestDelegateFactory.Create(@delegate); 2664var result = RequestDelegateFactory.Create(@delegate); 2677var result = RequestDelegateFactory.Create(@delegate); 2690var result = RequestDelegateFactory.Create(@delegate); 2710var result = RequestDelegateFactory.Create(@delegate, options); 2733var result = RequestDelegateFactory.Create(@delegate, options); 2756var result = RequestDelegateFactory.Create(@delegate, options); 2779var result = RequestDelegateFactory.Create(@delegate, options); 2802var result = RequestDelegateFactory.Create(@delegate, options); 2823var result = RequestDelegateFactory.Create(@delegate, options); 2844var result = RequestDelegateFactory.Create(@delegate, options); 2880var result = RequestDelegateFactory.Create(@delegate, options); 2915var result = RequestDelegateFactory.Create(@delegate, options, metadataResult); 2938var metadataResult = RequestDelegateFactory.InferMetadata(@delegate.Method, options); 2959var metadataResult = RequestDelegateFactory.InferMetadata(@delegate.Method, options); 2972var result = RequestDelegateFactory.Create(@delegate); 2985var result = RequestDelegateFactory.Create(@delegate); 2998var result = RequestDelegateFactory.Create(@delegate); 3011var result = RequestDelegateFactory.Create(@delegate); 3024var result = RequestDelegateFactory.Create(@delegate); 3038var result = RequestDelegateFactory.Create(@delegate, options); 3053var result = RequestDelegateFactory.Create(@delegate, new() { ServiceProvider = serviceProvider }); 3068var result = RequestDelegateFactory.Create(@delegate, new() { ServiceProvider = serviceProvider }); 3097var result = RequestDelegateFactory.Create(initialRequestDelegate, options); 3112var result = RequestDelegateFactory.Create(requestDelegate, options); 3123var result = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions() 3173var factoryResult = RequestDelegateFactory.Create(TestAction); 3226var factoryResult = RequestDelegateFactory.Create(TestAction); 3271var factoryResult = RequestDelegateFactory.Create(TestAction); 3312var exception = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(@delegate)); 3331var exception = Record.Exception(() => RequestDelegateFactory.Create(@delegate));
RequestDelegateFactoryTests.EndpointFilters.cs (2)
51var result = RequestDelegateFactory.Create(@delegate, options); 95var result = RequestDelegateFactory.Create(@delegate, options);
RequestDelegateFactoryTests.FormMapping.cs (7)
54var factoryResult = RequestDelegateFactory.Create(TestAction, options, metadataResult); 101var factoryResult = RequestDelegateFactory.Create(TestAction, options, metadataResult); 149var factoryResult = RequestDelegateFactory.Create(TestAction, options, metadataResult); 196var factoryResult = RequestDelegateFactory.Create(TestAction); 229var factoryResult = RequestDelegateFactory.Create(TestAction); 277var factoryResult = RequestDelegateFactory.Create(TestAction, options, metadataResult); 299var factoryResult = RequestDelegateFactory.Create(TestAction);
RequestDelegateGenerator\RequestDelegateCreationTests.Forms.cs (1)
326var factoryResult = RequestDelegateFactory.Create((HttpContext context, IFormFile file) =>
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (1)
EndpointMetadataApiDescriptionProviderTest.cs (1)
1791var requestDelegateResult = RequestDelegateFactory.Create(methodInfo, options: options);
Microsoft.AspNetCore.Routing (2)
Builder\EndpointRouteBuilderExtensions.cs (2)
439.AddRouteHandler(pattern, handler, httpMethods, isFallback, RequestDelegateFactory.InferMetadata, RequestDelegateFactory.Create, handler.Method);