示例#1
0
        /// <summary>
        /// Confirm that the Context is not null, and the Context's Command is not null.
        /// </summary>
        /// <param name="context">IRequestContext to verify</param>
        /// <returns>The non-null Command for this Context</returns>
        private IRequestCommand VerifyRequest(IRequestContext context)
        {
            if (null == context)
            {
                context = new RequestContext();
                context.AddAlert(msg_CATALOG_CONTEXT_NULL);
            }

            IRequestCommand command = context[Tokens.CommandBin] as IRequestCommand;

            if (null == command)
                context.AddAlert(msg_CATALOG_COMMAND_NULL);

            return command;
        }
示例#2
0
 public IRequestContext GetRequestContext(IRequestCommand command)
 {
     IRequestContext context;
     try
     {
         context = command.NewContext();
         context[Tokens.CommandBin] = command;
         context[Tokens.FieldTable] = FieldTable;
         // TODO: MessageTable
     }
     catch (Exception e)
     {
         context = new RequestContext();
         context.Fault = e;
         // ISSUE: Log exception(faults) (Log all errors in verbose mode?)
         // ISSUE: Provide an alternate location on fault? -- Declarative exception handing
     }
     return context;
 }