Example #1
0
        public override IComputed <T>?TryGetCached(InterceptedInput input)
        {
            if (!(ComputedRegistry.TryGet(input) is IReplicaClientComputed <T> computed))
            {
                return(null);
            }
            var replica = computed.Replica;

            if (replica == null || replica.UpdateError != null || replica.DisposalState != DisposalState.Active)
            {
                ComputedRegistry.Remove(computed);
                return(null);
            }
            return(computed);
        }
        public override IComputed <T>?TryGetCached(InterceptedInput input, IComputed?usedBy)
        {
            if (!(ComputedRegistry.TryGet(input) is IReplicaServiceComputed <T> computed))
            {
                return(null);
            }
            var replica = computed.Replica;

            if (replica == null || replica.UpdateError != null || replica.DisposalState != DisposalState.Active)
            {
                ComputedRegistry.Remove(computed);
                return(null);
            }
            ((IComputedImpl?)usedBy)?.AddUsed((IComputedImpl)computed);
            return(computed);
        }