diff --git a/src/DivertR/ViaBuilderExtensions.cs b/src/DivertR/ViaBuilderExtensions.cs index e5af5f82..03743e87 100644 --- a/src/DivertR/ViaBuilderExtensions.cs +++ b/src/DivertR/ViaBuilderExtensions.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace DivertR { @@ -16,7 +18,7 @@ public static IVia RedirectVia(this IFuncViaBuilder(); + var proxyCache = new ConcurrentDictionary(new ReferenceEqualityComparer()); var via = viaBuilder.Via.ViaSet.Via(name); TReturn? RedirectDelegate(IFuncRedirectCall call) @@ -36,5 +38,18 @@ public static IVia RedirectVia(this IFuncViaBuilder : IEqualityComparer where T : class + { + public int GetHashCode(T value) + { + return RuntimeHelpers.GetHashCode(value); + } + + public bool Equals(T left, T right) + { + return ReferenceEquals(left, right); + } + } } } \ No newline at end of file