コード例 #1
0
        public override async Task OnExecutedAsync(CancellationToken cancellationToken)
        {
            var currentMessageContext = base.GetCurrentMessageContext().ConfigureAwait(false).GetAwaiter().GetResult();

            currentMessageContext.StorageData = ((int)currentMessageContext.StorageData) + 1;
            GlobalMessageContext.UpdateMessageContext(currentMessageContext);//储存到缓存
        }
コード例 #2
0
        public override void OnExecuted()
        {
            var currentMessageContext = base.GetCurrentMessageContext().ConfigureAwait(false).GetAwaiter().GetResult();

            currentMessageContext.StorageData = ((int)currentMessageContext.StorageData) + 1;
            GlobalMessageContext.UpdateMessageContext(currentMessageContext);//储存到缓存
        }
コード例 #3
0
        public override void OnExecuted()
        {
            base.OnExecuted();
            var currentMessageContext = base.GetCurrentMessageContext();

            currentMessageContext.StorageData = ((int)currentMessageContext.StorageData) + 1;
            GlobalMessageContext.UpdateMessageContext(currentMessageContext);//储存到缓存
        }
コード例 #4
0
        public override async Task OnExecutedAsync(CancellationToken cancellationToken)
        {
            var currentMessageContext = await base.GetCurrentMessageContext();

            currentMessageContext.StorageData = ((int)currentMessageContext.StorageData) + 1;
            GlobalMessageContext.UpdateMessageContext(currentMessageContext);//储存到缓存
            await base.OnExecutedAsync(cancellationToken);
        }
コード例 #5
0
        public override async Task OnExecutedAsync(CancellationToken cancellationToken)
        {
            //演示:MessageContext.StorageData

            var currentMessageContext = await base.GetUnsafeMessageContext();//为了在分布式缓存下提高读写效率,使用此方法,如果需要获取实时数据,应该使用 base.GetCurrentMessageContext()

            currentMessageContext.StorageData = ((int)currentMessageContext.StorageData) + 1;
            GlobalMessageContext.UpdateMessageContext(currentMessageContext);//储存到缓存
            await base.OnExecutedAsync(cancellationToken);
        }
コード例 #6
0
        public override async Task OnExecutingAsync(CancellationToken cancellationToken)
        {
            var currentMessageContext = await base.GetCurrentMessageContext();

            if (currentMessageContext.StorageData == null || (currentMessageContext.StorageData is int))
            {
                currentMessageContext.StorageData = (int)0;
                GlobalMessageContext.UpdateMessageContext(currentMessageContext);//储存到缓存
            }
        }
コード例 #7
0
        public override void OnExecuting()
        {
            var currentMessageContext = base.GetCurrentMessageContext().ConfigureAwait(false).GetAwaiter().GetResult();

            if (currentMessageContext.StorageData == null || (currentMessageContext.StorageData is int))
            {
                currentMessageContext.StorageData = (int)0;
                GlobalMessageContext.UpdateMessageContext(currentMessageContext);//储存到缓存
            }
        }
コード例 #8
0
        public override void OnExecuting()
        {
            var currentMessageContext = base.GetCurrentMessageContext();

            if (currentMessageContext.StorageData == null || (currentMessageContext.StorageData is int))
            {
                currentMessageContext.StorageData = (int)0;
                GlobalMessageContext.UpdateMessageContext(currentMessageContext);//储存到缓存
            }
            base.OnExecuting();
        }