43 instantiations of ParameterBindingMethodCache
Microsoft.AspNetCore.Http.Extensions (2)
src\Shared\ParameterBindingMethodCache.cs (2)
30private static readonly Lazy<ParameterBindingMethodCache> _instance = new(() => new ParameterBindingMethodCache()); 32private static readonly Lazy<ParameterBindingMethodCache> _nonThrowingInstance = new(() => new ParameterBindingMethodCache(throwOnInvalidMethod: false));
Microsoft.AspNetCore.Http.Extensions.Tests (41)
ParameterBindingMethodCacheTests.cs (41)
29var methodFound = new ParameterBindingMethodCache().FindTryParseMethod(@type); 47var methodFound = new ParameterBindingMethodCache().FindTryParseMethod(typeof(Uri)); 69var methodFound = new ParameterBindingMethodCache().FindTryParseMethod(@type); 101var methodFound = new ParameterBindingMethodCache().FindTryParseMethod(@type); 126var methodFound = new ParameterBindingMethodCache().FindTryParseMethod(@type); 164Assert.True(new ParameterBindingMethodCache().HasTryParseMethod(parameterInfo.ParameterType)); 171var methodFound = new ParameterBindingMethodCache().FindTryParseMethod(type); 179var methodFound = new ParameterBindingMethodCache().FindTryParseMethod(type); 199var cache = new ParameterBindingMethodCache(preferNonGenericEnumParseOverload: true); 222var cache = new ParameterBindingMethodCache(); 253var cache = new ParameterBindingMethodCache(); 342Assert.True(new ParameterBindingMethodCache().HasBindAsyncMethod(parameterInfo)); 349Assert.True(new ParameterBindingMethodCache().HasBindAsyncMethod(parameterInfo)); 356Assert.True(new ParameterBindingMethodCache().HasBindAsyncMethod(parameterInfo)); 363Assert.True(new ParameterBindingMethodCache().HasBindAsyncMethod(parameterInfo)); 370Assert.True(new ParameterBindingMethodCache().HasBindAsyncMethod(parameterInfo)); 377Assert.True(new ParameterBindingMethodCache().HasBindAsyncMethod(parameterInfo)); 384var cache = new ParameterBindingMethodCache(); 402var cache = new ParameterBindingMethodCache(); 420var cache = new ParameterBindingMethodCache(); 436var cache = new ParameterBindingMethodCache(); 452var cache = new ParameterBindingMethodCache(); 474var cache = new ParameterBindingMethodCache(); 486var cache = new ParameterBindingMethodCache(); 500var cache = new ParameterBindingMethodCache(); 512var cache = new ParameterBindingMethodCache(); 524var cache = new ParameterBindingMethodCache(); 557() => new ParameterBindingMethodCache().FindTryParseMethod(type)); 567Assert.Null(new ParameterBindingMethodCache(throwOnInvalidMethod: false).FindTryParseMethod(type)); 574() => new ParameterBindingMethodCache().FindTryParseMethod(typeof(TryParseFromMultipleInterfaces))); 581Assert.Null(new ParameterBindingMethodCache(throwOnInvalidMethod: false).FindTryParseMethod(typeof(TryParseFromMultipleInterfaces))); 589var method = new ParameterBindingMethodCache().FindTryParseMethod(type); 616var cache = new ParameterBindingMethodCache(); 631var cache = new ParameterBindingMethodCache(throwOnInvalidMethod: false); 640var cache = new ParameterBindingMethodCache(); 649var cache = new ParameterBindingMethodCache(throwOnInvalidMethod: false); 660var cache = new ParameterBindingMethodCache(); 682var cache = new ParameterBindingMethodCache(); 692var cache = new ParameterBindingMethodCache(); 702var cache = new ParameterBindingMethodCache(); 714var cache = new ParameterBindingMethodCache();
49 references to ParameterBindingMethodCache
Microsoft.AspNetCore.Http.Extensions (19)
RequestDelegateFactory.cs (10)
91private static readonly ParameterExpression HttpContextExpr = ParameterBindingMethodCache.SharedExpressions.HttpContextExpr; 107private static readonly ParameterExpression TempSourceStringExpr = ParameterBindingMethodCache.SharedExpressions.TempSourceStringExpr; 790ParameterBindingMethodCache.Instance.HasTryParseMethod(parameter.ParameterType) || 791(parameter.ParameterType.IsArray && ParameterBindingMethodCache.Instance.HasTryParseMethod(parameter.ParameterType.GetElementType()!)); 867else if (ParameterBindingMethodCache.Instance.HasBindAsyncMethod(parameter)) 872else if (parameter.ParameterType == typeof(string) || ParameterBindingMethodCache.Instance.HasTryParseMethod(parameter.ParameterType)) 902(parameter.ParameterType.IsArray && ParameterBindingMethodCache.Instance.HasTryParseMethod(parameter.ParameterType.GetElementType()!)))) 1572var (constructor, parameters) = ParameterBindingMethodCache.Instance.FindConstructor(parameterType); 1683var tryParseMethodCall = ParameterBindingMethodCache.Instance.FindTryParseMethod(nonNullableParameterType); 1987var bindAsyncMethod = ParameterBindingMethodCache.Instance.FindBindAsyncMethod(parameter);
src\Shared\ParameterBindingMethodCache.cs (8)
15using static Microsoft.AspNetCore.Http.ParameterBindingMethodCache.SharedExpressions; 24private static readonly MethodInfo ConvertValueTaskMethod = typeof(ParameterBindingMethodCache).GetMethod(nameof(ConvertValueTask), BindingFlags.NonPublic | BindingFlags.Static)!; 25private static readonly MethodInfo ConvertValueTaskOfNullableResultMethod = typeof(ParameterBindingMethodCache).GetMethod(nameof(ConvertValueTaskOfNullableResult), BindingFlags.NonPublic | BindingFlags.Static)!; 26private static readonly MethodInfo BindAsyncMethod = typeof(ParameterBindingMethodCache).GetMethod(nameof(BindAsync), BindingFlags.NonPublic | BindingFlags.Static)!; 30private static readonly Lazy<ParameterBindingMethodCache> _instance = new(() => new ParameterBindingMethodCache()); 31public static ParameterBindingMethodCache Instance = _instance.Value; 32private static readonly Lazy<ParameterBindingMethodCache> _nonThrowingInstance = new(() => new ParameterBindingMethodCache(throwOnInvalidMethod: false)); 33public static ParameterBindingMethodCache NonThrowingInstance = _nonThrowingInstance.Value;
src\Shared\PropertyAsParameterInfo.cs (1)
64public static ReadOnlySpan<ParameterInfo> Flatten(ParameterInfo[] parameters, ParameterBindingMethodCache cache)
Microsoft.AspNetCore.Http.Extensions.Tests (30)
ParameterBindingMethodCacheTests.cs (30)
199var cache = new ParameterBindingMethodCache(preferNonGenericEnumParseOverload: true); 211parsedValue), ParameterBindingMethodCache.SharedExpressions.TempSourceStringExpr).Compile(); 222var cache = new ParameterBindingMethodCache(); 233ParameterBindingMethodCache.SharedExpressions.HttpContextExpr).Compile(); 253var cache = new ParameterBindingMethodCache(); 264ParameterBindingMethodCache.SharedExpressions.HttpContextExpr).Compile(); 384var cache = new ParameterBindingMethodCache(); 389ParameterBindingMethodCache.SharedExpressions.HttpContextExpr).Compile(); 402var cache = new ParameterBindingMethodCache(); 407ParameterBindingMethodCache.SharedExpressions.HttpContextExpr).Compile(); 420var cache = new ParameterBindingMethodCache(); 425ParameterBindingMethodCache.SharedExpressions.HttpContextExpr).Compile(); 436var cache = new ParameterBindingMethodCache(); 441ParameterBindingMethodCache.SharedExpressions.HttpContextExpr).Compile(); 452var cache = new ParameterBindingMethodCache(); 457ParameterBindingMethodCache.SharedExpressions.HttpContextExpr).Compile(); 474var cache = new ParameterBindingMethodCache(); 486var cache = new ParameterBindingMethodCache(); 500var cache = new ParameterBindingMethodCache(); 512var cache = new ParameterBindingMethodCache(); 524var cache = new ParameterBindingMethodCache(); 616var cache = new ParameterBindingMethodCache(); 631var cache = new ParameterBindingMethodCache(throwOnInvalidMethod: false); 640var cache = new ParameterBindingMethodCache(); 649var cache = new ParameterBindingMethodCache(throwOnInvalidMethod: false); 660var cache = new ParameterBindingMethodCache(); 682var cache = new ParameterBindingMethodCache(); 692var cache = new ParameterBindingMethodCache(); 702var cache = new ParameterBindingMethodCache(); 714var cache = new ParameterBindingMethodCache();