158 references to RequestDelegateFactory
Microsoft.AspNetCore.Http.Extensions (29)
RequestDelegateFactory.cs (23)
41
private static readonly MethodInfo ExecuteTaskWithEmptyResultMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteTaskWithEmptyResult), BindingFlags.NonPublic | BindingFlags.Static)!;
42
private static readonly MethodInfo ExecuteValueTaskWithEmptyResultMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteValueTaskWithEmptyResult), BindingFlags.NonPublic | BindingFlags.Static)!;
43
private static readonly MethodInfo ExecuteTaskOfTMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteTaskOfT), BindingFlags.NonPublic | BindingFlags.Static)!;
44
private static readonly MethodInfo ExecuteTaskOfTFastMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteTaskOfTFast), BindingFlags.NonPublic | BindingFlags.Static)!;
45
private static readonly MethodInfo ExecuteTaskOfObjectMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!;
46
private static readonly MethodInfo ExecuteValueTaskOfObjectMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!;
47
private static readonly MethodInfo ExecuteTaskOfStringMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteTaskOfString), BindingFlags.NonPublic | BindingFlags.Static)!;
48
private static readonly MethodInfo ExecuteValueTaskOfTMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteValueTaskOfT), BindingFlags.NonPublic | BindingFlags.Static)!;
49
private static readonly MethodInfo ExecuteValueTaskOfTFastMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteValueTaskOfTFast), BindingFlags.NonPublic | BindingFlags.Static)!;
50
private static readonly MethodInfo ExecuteValueTaskMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteValueTask), BindingFlags.NonPublic | BindingFlags.Static)!;
51
private static readonly MethodInfo ExecuteValueTaskOfStringMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteValueTaskOfString), BindingFlags.NonPublic | BindingFlags.Static)!;
52
private static readonly MethodInfo ExecuteTaskResultOfTMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteTaskResult), BindingFlags.NonPublic | BindingFlags.Static)!;
53
private static readonly MethodInfo ExecuteValueResultTaskOfTMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteValueTaskResult), BindingFlags.NonPublic | BindingFlags.Static)!;
54
private static readonly MethodInfo ExecuteAwaitedReturnMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteAwaitedReturn), BindingFlags.NonPublic | BindingFlags.Static)!;
59
private static readonly MethodInfo ResultWriteResponseAsyncMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteResultWriteResponse), BindingFlags.NonPublic | BindingFlags.Static)!;
60
private static readonly MethodInfo StringResultWriteResponseAsyncMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteWriteStringResponseAsync), BindingFlags.NonPublic | BindingFlags.Static)!;
62
private static readonly MethodInfo WrapObjectAsValueTaskMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(WrapObjectAsValueTask), BindingFlags.NonPublic | BindingFlags.Static)!;
63
private static readonly MethodInfo TaskOfTToValueTaskOfObjectMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(TaskOfTToValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!;
64
private static readonly MethodInfo ValueTaskOfTToValueTaskOfObjectMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ValueTaskOfTToValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!;
73
private static readonly MethodInfo JsonResultWriteResponseOfTFastAsyncMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(WriteJsonResponseFast), BindingFlags.NonPublic | BindingFlags.Static)!;
74
private static readonly MethodInfo JsonResultWriteResponseOfTAsyncMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(WriteJsonResponse), BindingFlags.NonPublic | BindingFlags.Static)!;
122
private static readonly MethodInfo ProcessFormMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ProcessForm), BindingFlags.Static | BindingFlags.NonPublic)!;
2793
return 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 (126)
RequestDelegateFactoryTests.cs (116)
106
var factoryResult =
RequestDelegateFactory
.Create(@delegate, new RequestDelegateFactoryOptions()
138
var factoryResult =
RequestDelegateFactory
.Create(methodInfo!);
184
var factoryResult =
RequestDelegateFactory
.Create(methodInfo!, _ => GetTarget());
210
var exNullAction = Assert.Throws<ArgumentNullException>(() =>
RequestDelegateFactory
.Create(handler: null!));
211
var exNullMethodInfo1 = Assert.Throws<ArgumentNullException>(() =>
RequestDelegateFactory
.Create(methodInfo: null!));
242
var factoryResult =
RequestDelegateFactory
.Create((int? id, HttpContext httpContext) =>
273
var factoryResult =
RequestDelegateFactory
.Create(methodInfo!);
291
RequestDelegateFactory
.Create(([FromRoute] int id) => { }, new() { RouteParameterNames = Array.Empty<string>() }));
587
var factoryResult =
RequestDelegateFactory
.Create(action);
614
var factoryResult =
RequestDelegateFactory
.Create(StoreNullableIntArray, new() { DisableInferBodyFromParameters = true });
640
var factoryResult =
RequestDelegateFactory
.Create((HttpContext context,
665
var factoryResult =
RequestDelegateFactory
.Create((HttpContext context,
694
var resultFactory =
RequestDelegateFactory
.Create(
729
var ex = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(action));
738
var ex = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(lambda.Compile()));
758
var factoryResult =
RequestDelegateFactory
.Create(StoreNullableIntArray, new() { ThrowOnBadRequest = true, DisableInferBodyFromParameters = true });
872
var factoryResult =
RequestDelegateFactory
.Create(action, new RequestDelegateFactoryOptions() { ServiceProvider = mock.Object });
891
var factoryResult =
RequestDelegateFactory
.Create(action);
906
var ex1 = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(Method1));
907
var ex2 = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(Method2));
908
var ex3 = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(Method3));
932
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestAttributedInvalidAction));
933
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestInferredInvalidAction));
934
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestBothInvalidAction));
943
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestTryParseStruct));
944
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestTryParseClass));
966
var ex = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestBindAsyncStruct));
967
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestBindAsyncClass));
1021
var exception = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(@delegate));
1031
Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestNestedParameterListRecordOnType));
1032
Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestNestedParameterListRecordOnArgument));
1122
var outParamException = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(OutMethod));
1123
var inParamException = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(InMethod));
1124
var refParamException = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(RefMethod));
1139
var factoryResult =
RequestDelegateFactory
.Create(action);
1161
var requestDelegateResult =
RequestDelegateFactory
.Create(action);
1184
var factoryResult =
RequestDelegateFactory
.Create(action, options: new() { ServiceProvider = services });
1204
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1228
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1249
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1269
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1289
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1349
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1382
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1412
Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestAction, new() { ServiceProvider = httpContext.RequestServices }));
1478
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1517
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1567
var factoryResult =
RequestDelegateFactory
.Create(@delegate, new()
1670
var factoryResult =
RequestDelegateFactory
.Create(routeHandler);
1748
var factoryResult =
RequestDelegateFactory
.Create(@delegate, options);
1783
var factoryResult =
RequestDelegateFactory
.Create(optionalQueryParam);
1813
var factoryResult =
RequestDelegateFactory
.Create(optionalQueryParam);
1843
var factoryResult =
RequestDelegateFactory
.Create(optionalQueryParam);
1870
var factoryResult =
RequestDelegateFactory
.Create(actionWithExtensionsResult);
1910
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1939
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1972
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
2003
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormFileAndJson));
2004
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormFilesAndJson));
2005
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormFileAndJsonWithAttribute));
2006
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormFileCollectionAndJson));
2007
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormCollectionAndJson));
2008
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormWithAttributeAndJson));
2009
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormFile));
2010
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormFiles));
2011
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormFileCollection));
2012
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormFileWithAttribute));
2013
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormCollection));
2014
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormWithAttribute));
2027
var nse = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestAction));
2076
var nse = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestAction));
2113
var exception = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(action));
2126
var exception = Assert.Throws<ArgumentException>(() =>
RequestDelegateFactory
.Create(TestAction));
2166
var factoryResult =
RequestDelegateFactory
.Create(methodInfo!, null, new RequestDelegateFactoryOptions()
2209
var factoryResult =
RequestDelegateFactory
.Create(methodInfo!, targetFactory, new RequestDelegateFactoryOptions()
2281
var factoryResult =
RequestDelegateFactory
.Create(@delegate, new RequestDelegateFactoryOptions()
2376
var factoryResult =
RequestDelegateFactory
.Create(@delegate, new RequestDelegateFactoryOptions()
2410
var factoryResult =
RequestDelegateFactory
.Create(HandlerWithTaskAwait, new RequestDelegateFactoryOptions()
2495
var factoryResult =
RequestDelegateFactory
.Create(@delegate, new RequestDelegateFactoryOptions()
2523
var result =
RequestDelegateFactory
.Create(@delegate);
2534
var result =
RequestDelegateFactory
.Create(@delegate);
2546
var result =
RequestDelegateFactory
.Create(@delegate);
2563
var result =
RequestDelegateFactory
.Create(@delegate, options);
2582
var result =
RequestDelegateFactory
.Create(@delegate);
2596
var result =
RequestDelegateFactory
.Create(@delegate);
2610
var result =
RequestDelegateFactory
.Create(@delegate);
2623
var result =
RequestDelegateFactory
.Create(@delegate);
2636
var result =
RequestDelegateFactory
.Create(@delegate);
2649
var result =
RequestDelegateFactory
.Create(@delegate);
2662
var result =
RequestDelegateFactory
.Create(@delegate);
2682
var result =
RequestDelegateFactory
.Create(@delegate, options);
2704
var result =
RequestDelegateFactory
.Create(@delegate, options);
2727
var result =
RequestDelegateFactory
.Create(@delegate, options);
2750
var result =
RequestDelegateFactory
.Create(@delegate, options);
2773
var result =
RequestDelegateFactory
.Create(@delegate, options);
2794
var result =
RequestDelegateFactory
.Create(@delegate, options);
2815
var result =
RequestDelegateFactory
.Create(@delegate, options);
2849
var result =
RequestDelegateFactory
.Create(@delegate, options);
2884
var result =
RequestDelegateFactory
.Create(@delegate, options, metadataResult);
2907
var metadataResult =
RequestDelegateFactory
.InferMetadata(@delegate.Method, options);
2928
var metadataResult =
RequestDelegateFactory
.InferMetadata(@delegate.Method, options);
2941
var result =
RequestDelegateFactory
.Create(@delegate);
2954
var result =
RequestDelegateFactory
.Create(@delegate);
2967
var result =
RequestDelegateFactory
.Create(@delegate);
2980
var result =
RequestDelegateFactory
.Create(@delegate);
2993
var result =
RequestDelegateFactory
.Create(@delegate);
3007
var result =
RequestDelegateFactory
.Create(@delegate, options);
3022
var result =
RequestDelegateFactory
.Create(@delegate, new() { ServiceProvider = serviceProvider });
3037
var result =
RequestDelegateFactory
.Create(@delegate, new() { ServiceProvider = serviceProvider });
3066
var result =
RequestDelegateFactory
.Create(initialRequestDelegate, options);
3081
var result =
RequestDelegateFactory
.Create(requestDelegate, options);
3092
var result =
RequestDelegateFactory
.Create(@delegate, new RequestDelegateFactoryOptions()
3142
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
3191
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
3232
var exception = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(@delegate));
3251
var exception = Record.Exception(() =>
RequestDelegateFactory
.Create(@delegate));
RequestDelegateFactoryTests.EndpointFilters.cs (2)
51
var result =
RequestDelegateFactory
.Create(@delegate, options);
95
var result =
RequestDelegateFactory
.Create(@delegate, options);
RequestDelegateFactoryTests.FormMapping.cs (7)
54
var factoryResult =
RequestDelegateFactory
.Create(TestAction, options, metadataResult);
101
var factoryResult =
RequestDelegateFactory
.Create(TestAction, options, metadataResult);
149
var factoryResult =
RequestDelegateFactory
.Create(TestAction, options, metadataResult);
196
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
229
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
277
var factoryResult =
RequestDelegateFactory
.Create(TestAction, options, metadataResult);
299
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
RequestDelegateGenerator\RequestDelegateCreationTests.Forms.cs (1)
326
var factoryResult =
RequestDelegateFactory
.Create((HttpContext context, IFormFile file) =>
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (1)
EndpointMetadataApiDescriptionProviderTest.cs (1)
1548
var 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);