private PerMethodCacheKey GetPropertyGetterCacheKey() { var propertyFromSetterCallOrNull = _invocation.Method.GetPropertyFromSetterCall(); var getter = propertyFromSetterCallOrNull.GetGetMethod(true); var key = PerMethodCacheKey.For(getter, _invocation.Proxy); return(key); }
public void GenerateAndAddMethodReturnValueTo(PerMethodCache <object> perMethodCache, GenerationRequest request) { var cacheKey = PerMethodCacheKey.For(_invocation); if (!perMethodCache.AlreadyContainsValueFor(cacheKey)) { var returnValue = AnyInstanceOfReturnTypeOf(_invocation, request); perMethodCache.Add(cacheKey, returnValue); _invocation.ReturnValue = returnValue; } else { _invocation.ReturnValue = perMethodCache.ValueFor(cacheKey); } }