示例#1
0
        T IPayloadCache.AddOrUpdatePayload <T>(PayloadFactory <T> addFactory, UpdatePayloadFactory <T> updateFactory)
        {
            if (_payloadCache.TryGetPayload(out T existingPayload))
            {
                return(_payloadCache.AddOrUpdatePayload(addFactory, updateFactory));
            }

            if (_parentCache.TryGetPayload(out existingPayload))
            {
                T Add() => updateFactory(existingPayload);

                return(_payloadCache.AddOrUpdatePayload(Add, updateFactory));
            }

            return(_payloadCache.AddOrUpdatePayload(addFactory, updateFactory));
        }
示例#2
0
        T PipeContext.AddOrUpdatePayload <T>(PayloadFactory <T> addFactory, UpdatePayloadFactory <T> updateFactory)
        {
            if (_payloadCache != null)
            {
                return(_payloadCache.AddOrUpdatePayload(addFactory, updateFactory));
            }

            return(_context.AddOrUpdatePayload(addFactory, updateFactory));
        }