@@ -235,26 +235,37 @@ public static void ValidateUrlHelper(
235
235
/// <summary>
236
236
/// Validates whether UrlHelper contains the same type as the provided one from action result containing such property.
237
237
/// </summary>
238
- /// <typeparam name="TUrlHelper">Type of IUrlHelper.</typeparam>
239
238
/// <param name="actionResult">Action result with UrlHelper.</param>
240
239
/// <param name="failedValidationAction">Action to call in case of failed validation.</param>
241
- public static void ValidateUrlHelperOfType < TUrlHelper > (
240
+ /// <param name="urlHelperType"></param>
241
+ public static void ValidateUrlHelperOfType (
242
242
dynamic actionResult ,
243
- Action < string , string , string > failedValidationAction )
244
- where TUrlHelper : IUrlHelper
243
+ Action < string , string , string > failedValidationAction , Type urlHelperType )
245
244
{
246
245
RuntimeBinderValidator . ValidateBinding ( ( ) =>
247
246
{
248
247
var actualUrlHelper = ( IUrlHelper ) actionResult . UrlHelper ;
249
248
if ( actualUrlHelper == null ||
250
- Reflection . AreDifferentTypes ( typeof ( TUrlHelper ) , actualUrlHelper . GetType ( ) ) )
249
+ Reflection . AreDifferentTypes ( urlHelperType , actualUrlHelper . GetType ( ) ) )
251
250
{
252
251
failedValidationAction (
253
252
"URL helper" ,
254
- $ "to be of { typeof ( TUrlHelper ) . Name } type",
253
+ $ "to be of { urlHelperType . Name } type",
255
254
$ "instead received { actualUrlHelper . GetName ( ) } ") ;
256
255
}
257
256
} ) ;
258
257
}
258
+
259
+ /// <summary>
260
+ /// Validates whether UrlHelper contains the same type as the provided one from action result containing such property.
261
+ /// </summary>
262
+ /// <typeparam name="TUrlHelper">Type of IUrlHelper.</typeparam>
263
+ /// <param name="actionResult">Action result with UrlHelper.</param>
264
+ /// <param name="failedValidationAction">Action to call in case of failed validation.</param>
265
+ public static void ValidateUrlHelperOfType < TUrlHelper > (
266
+ dynamic actionResult ,
267
+ Action < string , string , string > failedValidationAction )
268
+ where TUrlHelper : IUrlHelper
269
+ => RouteActionResultValidator . ValidateUrlHelperOfType ( actionResult , failedValidationAction , typeof ( TUrlHelper ) ) ;
259
270
}
260
271
}
0 commit comments