155 references to RequestDelegateFactory
Microsoft.AspNetCore.Http.Extensions (29)
RequestDelegateFactory.cs (23)
43private static readonly MethodInfo ExecuteTaskWithEmptyResultMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskWithEmptyResult), BindingFlags.NonPublic | BindingFlags.Static)!; 44private static readonly MethodInfo ExecuteValueTaskWithEmptyResultMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskWithEmptyResult), BindingFlags.NonPublic | BindingFlags.Static)!; 45private static readonly MethodInfo ExecuteTaskOfTMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskOfT), BindingFlags.NonPublic | BindingFlags.Static)!; 46private static readonly MethodInfo ExecuteTaskOfTFastMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskOfTFast), BindingFlags.NonPublic | BindingFlags.Static)!; 47private static readonly MethodInfo ExecuteTaskOfObjectMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!; 48private static readonly MethodInfo ExecuteValueTaskOfObjectMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!; 49private static readonly MethodInfo ExecuteTaskOfStringMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskOfString), BindingFlags.NonPublic | BindingFlags.Static)!; 50private static readonly MethodInfo ExecuteValueTaskOfTMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskOfT), BindingFlags.NonPublic | BindingFlags.Static)!; 51private static readonly MethodInfo ExecuteValueTaskOfTFastMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskOfTFast), BindingFlags.NonPublic | BindingFlags.Static)!; 52private static readonly MethodInfo ExecuteValueTaskMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTask), BindingFlags.NonPublic | BindingFlags.Static)!; 53private static readonly MethodInfo ExecuteValueTaskOfStringMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskOfString), BindingFlags.NonPublic | BindingFlags.Static)!; 54private static readonly MethodInfo ExecuteTaskResultOfTMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteTaskResult), BindingFlags.NonPublic | BindingFlags.Static)!; 55private static readonly MethodInfo ExecuteValueResultTaskOfTMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteValueTaskResult), BindingFlags.NonPublic | BindingFlags.Static)!; 56private static readonly MethodInfo ExecuteAwaitedReturnMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteAwaitedReturn), BindingFlags.NonPublic | BindingFlags.Static)!; 61private static readonly MethodInfo ResultWriteResponseAsyncMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteResultWriteResponse), BindingFlags.NonPublic | BindingFlags.Static)!; 62private static readonly MethodInfo StringResultWriteResponseAsyncMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ExecuteWriteStringResponseAsync), BindingFlags.NonPublic | BindingFlags.Static)!; 64private static readonly MethodInfo WrapObjectAsValueTaskMethod = typeof(RequestDelegateFactory).GetMethod(nameof(WrapObjectAsValueTask), BindingFlags.NonPublic | BindingFlags.Static)!; 65private static readonly MethodInfo TaskOfTToValueTaskOfObjectMethod = typeof(RequestDelegateFactory).GetMethod(nameof(TaskOfTToValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!; 66private static readonly MethodInfo ValueTaskOfTToValueTaskOfObjectMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ValueTaskOfTToValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!; 75private static readonly MethodInfo JsonResultWriteResponseOfTFastAsyncMethod = typeof(RequestDelegateFactory).GetMethod(nameof(WriteJsonResponseFast), BindingFlags.NonPublic | BindingFlags.Static)!; 76private static readonly MethodInfo JsonResultWriteResponseOfTAsyncMethod = typeof(RequestDelegateFactory).GetMethod(nameof(WriteJsonResponse), BindingFlags.NonPublic | BindingFlags.Static)!; 124private static readonly MethodInfo ProcessFormMethod = typeof(RequestDelegateFactory).GetMethod(nameof(ProcessForm), BindingFlags.Static | BindingFlags.NonPublic)!; 2763return 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 (124)
RequestDelegateFactoryTests.cs (116)
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, 694var resultFactory = RequestDelegateFactory.Create( 729var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(action)); 738var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(lambda.Compile())); 758var factoryResult = RequestDelegateFactory.Create(StoreNullableIntArray, new() { ThrowOnBadRequest = true, DisableInferBodyFromParameters = true }); 872var factoryResult = RequestDelegateFactory.Create(action, new RequestDelegateFactoryOptions() { ServiceProvider = mock.Object }); 891var factoryResult = RequestDelegateFactory.Create(action); 906var ex1 = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(Method1)); 907var ex2 = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(Method2)); 908var ex3 = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(Method3)); 932Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestAttributedInvalidAction)); 933Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestInferredInvalidAction)); 934Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestBothInvalidAction)); 943Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestTryParseStruct)); 944Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestTryParseClass)); 966var ex = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestBindAsyncStruct)); 967Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestBindAsyncClass)); 1021var exception = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(@delegate)); 1031Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestNestedParameterListRecordOnType)); 1032Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestNestedParameterListRecordOnArgument)); 1122var outParamException = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(OutMethod)); 1123var inParamException = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(InMethod)); 1124var refParamException = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(RefMethod)); 1139var factoryResult = RequestDelegateFactory.Create(action); 1161var requestDelegateResult = RequestDelegateFactory.Create(action); 1184var factoryResult = RequestDelegateFactory.Create(action, options: new() { ServiceProvider = services }); 1204var factoryResult = RequestDelegateFactory.Create(TestAction); 1228var factoryResult = RequestDelegateFactory.Create(TestAction); 1249var factoryResult = RequestDelegateFactory.Create(TestAction); 1269var factoryResult = RequestDelegateFactory.Create(TestAction); 1289var factoryResult = RequestDelegateFactory.Create(TestAction); 1349var factoryResult = RequestDelegateFactory.Create(@delegate); 1382var factoryResult = RequestDelegateFactory.Create(@delegate); 1412Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestAction, new() { ServiceProvider = httpContext.RequestServices })); 1478var factoryResult = RequestDelegateFactory.Create(@delegate); 1517var factoryResult = RequestDelegateFactory.Create(@delegate); 1567var factoryResult = RequestDelegateFactory.Create(@delegate, new() 1670var factoryResult = RequestDelegateFactory.Create(routeHandler); 1748var factoryResult = RequestDelegateFactory.Create(@delegate, options); 1783var factoryResult = RequestDelegateFactory.Create(optionalQueryParam); 1813var factoryResult = RequestDelegateFactory.Create(optionalQueryParam); 1843var factoryResult = RequestDelegateFactory.Create(optionalQueryParam); 1870var factoryResult = RequestDelegateFactory.Create(actionWithExtensionsResult); 1910var factoryResult = RequestDelegateFactory.Create(@delegate); 1939var factoryResult = RequestDelegateFactory.Create(TestAction); 1972var factoryResult = RequestDelegateFactory.Create(TestAction); 2003Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFileAndJson)); 2004Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFilesAndJson)); 2005Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFileAndJsonWithAttribute)); 2006Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormFileCollectionAndJson)); 2007Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormCollectionAndJson)); 2008Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestFormWithAttributeAndJson)); 2009Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFile)); 2010Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFiles)); 2011Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFileCollection)); 2012Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormFileWithAttribute)); 2013Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormCollection)); 2014Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(TestJsonAndFormWithAttribute)); 2027var nse = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestAction)); 2076var nse = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(TestAction)); 2113var exception = Assert.Throws<InvalidOperationException>(() => RequestDelegateFactory.Create(action)); 2126var exception = Assert.Throws<ArgumentException>(() => RequestDelegateFactory.Create(TestAction)); 2166var factoryResult = RequestDelegateFactory.Create(methodInfo!, null, new RequestDelegateFactoryOptions() 2209var factoryResult = RequestDelegateFactory.Create(methodInfo!, targetFactory, new RequestDelegateFactoryOptions() 2281var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions() 2376var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions() 2410var factoryResult = RequestDelegateFactory.Create(HandlerWithTaskAwait, new RequestDelegateFactoryOptions() 2495var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions() 2523var result = RequestDelegateFactory.Create(@delegate); 2534var result = RequestDelegateFactory.Create(@delegate); 2546var result = RequestDelegateFactory.Create(@delegate); 2563var result = RequestDelegateFactory.Create(@delegate, options); 2581var result = RequestDelegateFactory.Create(@delegate); 2595var result = RequestDelegateFactory.Create(@delegate); 2609var result = RequestDelegateFactory.Create(@delegate); 2622var result = RequestDelegateFactory.Create(@delegate); 2635var result = RequestDelegateFactory.Create(@delegate); 2648var result = RequestDelegateFactory.Create(@delegate); 2661var result = RequestDelegateFactory.Create(@delegate); 2681var result = RequestDelegateFactory.Create(@delegate, options); 2703var result = RequestDelegateFactory.Create(@delegate, options); 2725var result = RequestDelegateFactory.Create(@delegate, options); 2747var result = RequestDelegateFactory.Create(@delegate, options); 2769var result = RequestDelegateFactory.Create(@delegate, options); 2790var result = RequestDelegateFactory.Create(@delegate, options); 2811var result = RequestDelegateFactory.Create(@delegate, options); 2843var result = RequestDelegateFactory.Create(@delegate, options); 2878var result = RequestDelegateFactory.Create(@delegate, options, metadataResult); 2901var metadataResult = RequestDelegateFactory.InferMetadata(@delegate.Method, options); 2922var metadataResult = RequestDelegateFactory.InferMetadata(@delegate.Method, options); 2935var result = RequestDelegateFactory.Create(@delegate); 2948var result = RequestDelegateFactory.Create(@delegate); 2961var result = RequestDelegateFactory.Create(@delegate); 2974var result = RequestDelegateFactory.Create(@delegate); 2987var result = RequestDelegateFactory.Create(@delegate); 3001var result = RequestDelegateFactory.Create(@delegate, options); 3016var result = RequestDelegateFactory.Create(@delegate, new() { ServiceProvider = serviceProvider }); 3031var result = RequestDelegateFactory.Create(@delegate, new() { ServiceProvider = serviceProvider }); 3060var result = RequestDelegateFactory.Create(initialRequestDelegate, options); 3075var result = RequestDelegateFactory.Create(requestDelegate, options); 3086var result = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions() 3136var factoryResult = RequestDelegateFactory.Create(TestAction); 3185var factoryResult = RequestDelegateFactory.Create(TestAction); 3226var exception = Assert.Throws<NotSupportedException>(() => RequestDelegateFactory.Create(@delegate)); 3245var exception = Record.Exception(() => RequestDelegateFactory.Create(@delegate));
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.Routing (2)
Builder\EndpointRouteBuilderExtensions.cs (2)
439.AddRouteHandler(pattern, handler, httpMethods, isFallback, RequestDelegateFactory.InferMetadata, RequestDelegateFactory.Create, handler.Method);