19
19
namespace Microsoft . AspNetCore . Http
20
20
{
21
21
/// <summary>
22
- /// Builds <see cref="RequestDelegate"/> implementations from <see cref="Delegate"/> request handlers.
22
+ /// Creates <see cref="RequestDelegate"/> implementations from <see cref="Delegate"/> request handlers.
23
23
/// </summary>
24
24
public static class RequestDelegateFactory
25
25
{
@@ -47,10 +47,10 @@ public static class RequestDelegateFactory
47
47
private static readonly MemberExpression RequestAbortedExpr = Expression . Property ( HttpContextParameter , nameof ( HttpContext . RequestAborted ) ) ;
48
48
49
49
/// <summary>
50
- /// Builds a <see cref="RequestDelegate"/> implementation for <paramref name="action"/>.
50
+ /// Creates a <see cref="RequestDelegate"/> implementation for <paramref name="action"/>.
51
51
/// </summary>
52
52
/// <param name="action">A request handler with any number of custom parameters that often produces a response with its return value.</param>
53
- /// <returns>The <see cref="RequestDelegate"/></returns>
53
+ /// <returns>The <see cref="RequestDelegate"/>. </returns>
54
54
public static RequestDelegate Create ( Delegate action )
55
55
{
56
56
if ( action is null )
@@ -60,11 +60,11 @@ public static RequestDelegate Create(Delegate action)
60
60
61
61
var targetExpression = action . Target switch
62
62
{
63
- { } => Expression . Convert ( TargetArg , action . Target . GetType ( ) ) ,
63
+ object => Expression . Convert ( TargetArg , action . Target . GetType ( ) ) ,
64
64
null => null ,
65
65
} ;
66
66
67
- var untargetedRequestDelegate = BuildRequestDelegate ( action . Method , targetExpression ) ;
67
+ var untargetedRequestDelegate = CreateRequestDelegate ( action . Method , targetExpression ) ;
68
68
69
69
return httpContext =>
70
70
{
@@ -73,18 +73,18 @@ public static RequestDelegate Create(Delegate action)
73
73
}
74
74
75
75
/// <summary>
76
- /// Builds a <see cref="RequestDelegate"/> implementation for <paramref name="methodInfo"/>.
76
+ /// Creates a <see cref="RequestDelegate"/> implementation for <paramref name="methodInfo"/>.
77
77
/// </summary>
78
78
/// <param name="methodInfo">A static request handler with any number of custom parameters that often produces a response with its return value.</param>
79
- /// <returns>The <see cref="RequestDelegate"/></returns>
79
+ /// <returns>The <see cref="RequestDelegate"/>. </returns>
80
80
public static RequestDelegate Create ( MethodInfo methodInfo )
81
81
{
82
82
if ( methodInfo is null )
83
83
{
84
84
throw new ArgumentNullException ( nameof ( methodInfo ) ) ;
85
85
}
86
86
87
- var untargetedRequestDelegate = BuildRequestDelegate ( methodInfo , targetExpression : null ) ;
87
+ var untargetedRequestDelegate = CreateRequestDelegate ( methodInfo , targetExpression : null ) ;
88
88
89
89
return httpContext =>
90
90
{
@@ -93,11 +93,11 @@ public static RequestDelegate Create(MethodInfo methodInfo)
93
93
}
94
94
95
95
/// <summary>
96
- /// Builds a <see cref="RequestDelegate"/> implementation for <paramref name="methodInfo"/>.
96
+ /// Creates a <see cref="RequestDelegate"/> implementation for <paramref name="methodInfo"/>.
97
97
/// </summary>
98
98
/// <param name="methodInfo">A request handler with any number of custom parameters that often produces a response with its return value.</param>
99
99
/// <param name="targetFactory">Creates the <see langword="this"/> for the non-static method.</param>
100
- /// <returns>The <see cref="RequestDelegate"/></returns>
100
+ /// <returns>The <see cref="RequestDelegate"/>. </returns>
101
101
public static RequestDelegate Create ( MethodInfo methodInfo , Func < HttpContext , object > targetFactory )
102
102
{
103
103
if ( methodInfo is null )
@@ -116,15 +116,15 @@ public static RequestDelegate Create(MethodInfo methodInfo, Func<HttpContext, ob
116
116
}
117
117
118
118
var targetExpression = Expression . Convert ( TargetArg , methodInfo . DeclaringType ) ;
119
- var untargetedRequestDelegate = BuildRequestDelegate ( methodInfo , targetExpression ) ;
119
+ var untargetedRequestDelegate = CreateRequestDelegate ( methodInfo , targetExpression ) ;
120
120
121
121
return httpContext =>
122
122
{
123
123
return untargetedRequestDelegate ( targetFactory ( httpContext ) , httpContext ) ;
124
124
} ;
125
125
}
126
126
127
- private static Func < object ? , HttpContext , Task > BuildRequestDelegate ( MethodInfo methodInfo , Expression ? targetExpression )
127
+ private static Func < object ? , HttpContext , Task > CreateRequestDelegate ( MethodInfo methodInfo , Expression ? targetExpression )
128
128
{
129
129
// Non void return type
130
130
0 commit comments