160 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)!;
60
private static readonly MethodInfo ResultWriteResponseAsyncMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteResultWriteResponse), BindingFlags.NonPublic | BindingFlags.Static)!;
61
private static readonly MethodInfo StringResultWriteResponseAsyncMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ExecuteWriteStringResponseAsync), BindingFlags.NonPublic | BindingFlags.Static)!;
63
private static readonly MethodInfo WrapObjectAsValueTaskMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(WrapObjectAsValueTask), BindingFlags.NonPublic | BindingFlags.Static)!;
64
private static readonly MethodInfo TaskOfTToValueTaskOfObjectMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(TaskOfTToValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!;
65
private static readonly MethodInfo ValueTaskOfTToValueTaskOfObjectMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ValueTaskOfTToValueTaskOfObject), BindingFlags.NonPublic | BindingFlags.Static)!;
74
private static readonly MethodInfo JsonResultWriteResponseOfTFastAsyncMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(WriteJsonResponseFast), BindingFlags.NonPublic | BindingFlags.Static)!;
75
private static readonly MethodInfo JsonResultWriteResponseOfTAsyncMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(WriteJsonResponse), BindingFlags.NonPublic | BindingFlags.Static)!;
123
private static readonly MethodInfo ProcessFormMethod = typeof(
RequestDelegateFactory
).GetMethod(nameof(ProcessForm), BindingFlags.Static | BindingFlags.NonPublic)!;
2839
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 (128)
RequestDelegateFactoryTests.cs (118)
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,
696
var factoryResult =
RequestDelegateFactory
.Create(
722
var resultFactory =
RequestDelegateFactory
.Create(
757
var ex = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(action));
766
var ex = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(lambda.Compile()));
786
var factoryResult =
RequestDelegateFactory
.Create(StoreNullableIntArray, new() { ThrowOnBadRequest = true, DisableInferBodyFromParameters = true });
900
var factoryResult =
RequestDelegateFactory
.Create(action, new RequestDelegateFactoryOptions() { ServiceProvider = mock.Object });
919
var factoryResult =
RequestDelegateFactory
.Create(action);
934
var ex1 = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(Method1));
935
var ex2 = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(Method2));
936
var ex3 = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(Method3));
960
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestAttributedInvalidAction));
961
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestInferredInvalidAction));
962
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestBothInvalidAction));
971
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestTryParseStruct));
972
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestTryParseClass));
994
var ex = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestBindAsyncStruct));
995
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestBindAsyncClass));
1049
var exception = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(@delegate));
1059
Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestNestedParameterListRecordOnType));
1060
Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestNestedParameterListRecordOnArgument));
1150
var outParamException = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(OutMethod));
1151
var inParamException = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(InMethod));
1152
var refParamException = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(RefMethod));
1167
var factoryResult =
RequestDelegateFactory
.Create(action);
1189
var requestDelegateResult =
RequestDelegateFactory
.Create(action);
1212
var factoryResult =
RequestDelegateFactory
.Create(action, options: new() { ServiceProvider = services });
1232
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1256
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1277
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1297
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1317
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
1377
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1410
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1440
Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestAction, new() { ServiceProvider = httpContext.RequestServices }));
1506
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1545
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1595
var factoryResult =
RequestDelegateFactory
.Create(@delegate, new()
1698
var factoryResult =
RequestDelegateFactory
.Create(routeHandler);
1776
var factoryResult =
RequestDelegateFactory
.Create(@delegate, options);
1811
var factoryResult =
RequestDelegateFactory
.Create(optionalQueryParam);
1841
var factoryResult =
RequestDelegateFactory
.Create(optionalQueryParam);
1871
var factoryResult =
RequestDelegateFactory
.Create(optionalQueryParam);
1898
var factoryResult =
RequestDelegateFactory
.Create(actionWithExtensionsResult);
1938
var factoryResult =
RequestDelegateFactory
.Create(@delegate);
1967
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
2000
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
2031
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormFileAndJson));
2032
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormFilesAndJson));
2033
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormFileAndJsonWithAttribute));
2034
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormFileCollectionAndJson));
2035
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormCollectionAndJson));
2036
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestFormWithAttributeAndJson));
2037
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormFile));
2038
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormFiles));
2039
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormFileCollection));
2040
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormFileWithAttribute));
2041
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormCollection));
2042
Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(TestJsonAndFormWithAttribute));
2055
var nse = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestAction));
2104
var nse = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(TestAction));
2141
var exception = Assert.Throws<InvalidOperationException>(() =>
RequestDelegateFactory
.Create(action));
2154
var exception = Assert.Throws<ArgumentException>(() =>
RequestDelegateFactory
.Create(TestAction));
2194
var factoryResult =
RequestDelegateFactory
.Create(methodInfo!, null, new RequestDelegateFactoryOptions()
2237
var factoryResult =
RequestDelegateFactory
.Create(methodInfo!, targetFactory, new RequestDelegateFactoryOptions()
2309
var factoryResult =
RequestDelegateFactory
.Create(@delegate, new RequestDelegateFactoryOptions()
2404
var factoryResult =
RequestDelegateFactory
.Create(@delegate, new RequestDelegateFactoryOptions()
2438
var factoryResult =
RequestDelegateFactory
.Create(HandlerWithTaskAwait, new RequestDelegateFactoryOptions()
2523
var factoryResult =
RequestDelegateFactory
.Create(@delegate, new RequestDelegateFactoryOptions()
2551
var result =
RequestDelegateFactory
.Create(@delegate);
2562
var result =
RequestDelegateFactory
.Create(@delegate);
2574
var result =
RequestDelegateFactory
.Create(@delegate);
2591
var result =
RequestDelegateFactory
.Create(@delegate, options);
2610
var result =
RequestDelegateFactory
.Create(@delegate);
2624
var result =
RequestDelegateFactory
.Create(@delegate);
2638
var result =
RequestDelegateFactory
.Create(@delegate);
2651
var result =
RequestDelegateFactory
.Create(@delegate);
2664
var result =
RequestDelegateFactory
.Create(@delegate);
2677
var result =
RequestDelegateFactory
.Create(@delegate);
2690
var result =
RequestDelegateFactory
.Create(@delegate);
2710
var result =
RequestDelegateFactory
.Create(@delegate, options);
2733
var result =
RequestDelegateFactory
.Create(@delegate, options);
2756
var result =
RequestDelegateFactory
.Create(@delegate, options);
2779
var result =
RequestDelegateFactory
.Create(@delegate, options);
2802
var result =
RequestDelegateFactory
.Create(@delegate, options);
2823
var result =
RequestDelegateFactory
.Create(@delegate, options);
2844
var result =
RequestDelegateFactory
.Create(@delegate, options);
2880
var result =
RequestDelegateFactory
.Create(@delegate, options);
2915
var result =
RequestDelegateFactory
.Create(@delegate, options, metadataResult);
2938
var metadataResult =
RequestDelegateFactory
.InferMetadata(@delegate.Method, options);
2959
var metadataResult =
RequestDelegateFactory
.InferMetadata(@delegate.Method, options);
2972
var result =
RequestDelegateFactory
.Create(@delegate);
2985
var result =
RequestDelegateFactory
.Create(@delegate);
2998
var result =
RequestDelegateFactory
.Create(@delegate);
3011
var result =
RequestDelegateFactory
.Create(@delegate);
3024
var result =
RequestDelegateFactory
.Create(@delegate);
3038
var result =
RequestDelegateFactory
.Create(@delegate, options);
3053
var result =
RequestDelegateFactory
.Create(@delegate, new() { ServiceProvider = serviceProvider });
3068
var result =
RequestDelegateFactory
.Create(@delegate, new() { ServiceProvider = serviceProvider });
3097
var result =
RequestDelegateFactory
.Create(initialRequestDelegate, options);
3112
var result =
RequestDelegateFactory
.Create(requestDelegate, options);
3123
var result =
RequestDelegateFactory
.Create(@delegate, new RequestDelegateFactoryOptions()
3173
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
3226
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
3271
var factoryResult =
RequestDelegateFactory
.Create(TestAction);
3312
var exception = Assert.Throws<NotSupportedException>(() =>
RequestDelegateFactory
.Create(@delegate));
3331
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)
1791
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);