private IEnumerable <MethodInterception> GetStoreComputedValueInterceptions() { var computedValues = storeMetadata.GetComputedValues(); return(computedValues.Select(computedValueMethod => { Type containerType = typeof(ComputedValueContainer <,>).MakeGenericType(typeof(TStore), computedValueMethod.ReturnType); IPropertyProxy propertyProxy = propertyProxyFactory.Create(RootObservableProperty); var store = propertyProxyWrapper.WrapPropertyObservable <TStore>(propertyProxy); DependencyInjector.InjectDependency(store); IComputedValueInvokable target = (IComputedValueInvokable)Activator.CreateInstance(containerType, store); ComputedValueInvoker <TStore> invoker = new ComputedValueInvoker <TStore>(OnComputedValueChanged, target, this); invoker.PlantSubscriber(propertyProxy); MethodInfo interceptorMethod = containerType.GetMethod("OnMethodInvoke"); return new ClassMethodInterception { InterceptedMethod = computedValueMethod, InterceptorMethod = interceptorMethod, InterceptorTarget = target, ProvideInterceptedTarget = false }; })); }
public ComputedValueInvoker( EventHandler <ComputedValueChangedArgs> computedValueChangedEvent, IComputedValueInvokable computedValue, IStoreHolder <TStore> storeHolder) : base(computedValue, storeHolder) { this.computedValueChangedEvent = computedValueChangedEvent; this.computedValue = computedValue; }