示例#1
0
        public virtual T AddOrUpdatePayload <T>(PayloadFactory <T> addFactory, UpdatePayloadFactory <T> updateFactory)
            where T : class
        {
            if (this is T context)
            {
                return(context);
            }

            return(PayloadCache.AddOrUpdatePayload(addFactory, updateFactory));
        }
示例#2
0
        public virtual T GetOrAddPayload <T>(PayloadFactory <T> payloadFactory)
            where T : class
        {
            if (this is T context)
            {
                return(context);
            }

            return(PayloadCache.GetOrAddPayload(payloadFactory));
        }
示例#3
0
        public virtual bool TryGetPayload <T>(out T payload)
            where T : class
        {
            if (this is T context)
            {
                payload = context;
                return(true);
            }

            return(PayloadCache.TryGetPayload(out payload));
        }
示例#4
0
 public virtual bool HasPayloadType(Type payloadType)
 {
     return(payloadType.GetTypeInfo().IsInstanceOfType(this) || PayloadCache.HasPayloadType(payloadType));
 }