コード例 #1
0
        /// <summary>
        /// Executes this behavior for the specified command.
        /// </summary>
        /// <typeparam name="TResponse">The type of the response.</typeparam>
        /// <param name="request">The command.</param>
        /// <returns></returns>
        public async Task <CommandBehaviorResult> ExecuteAsync <TResponse>(CommandRequest <TResponse> request)
        {
            EnsureArg.IsNotNull(request);

            var path = this.pathTemplate
                       .Replace("{id}", request.Id)
                       .Replace("{type}", request.GetType().PrettyName(false));

            await this.fileStorage.SaveFileObjectAsync(path, request, this.serializer).AnyContext();

            return(await Task.FromResult(new CommandBehaviorResult()).AnyContext());
        }
コード例 #2
0
            public bool HandleCommand(CommandRequest request)
            {
                CommandHandler handler = FindHandlerFor(request);

                if (handler == null)
                {
                    Debug.LogErrorFormat("No handler available for {0}.", request.GetType());
                    return(false);
                }

                handler.Inject(request);
                handler.Execute(m_Owner);
                return(true);
            }