예제 #1
0
 private object ConvertNamedParameter <TMessage>(IWampFormatter <TMessage> formatter,
                                                 LocalParameter parameter,
                                                 TMessage value)
 {
     try
     {
         return(ConvertParameter(formatter, parameter, value));
     }
     catch (Exception ex)
     {
         throw NameError(parameter.Name, ex);
     }
 }
예제 #2
0
 private object GetPositionalParameterValue <TMessage>(IWampFormatter <TMessage> formatter,
                                                       LocalParameter parameter,
                                                       TMessage value)
 {
     try
     {
         return(ConvertParameter(formatter, parameter, value));
     }
     catch (Exception ex)
     {
         throw PositionError(parameter.Position, ex);
     }
 }
예제 #3
0
        private object GetNamedParameterValue <TMessage>(IWampFormatter <TMessage> formatter, LocalParameter parameter, IDictionary <string, TMessage> argumentKeywords)
        {
            if (parameter.Name == null)
            {
                throw PositionError(parameter.Position);
            }
            else
            {
                TMessage value;

                if (argumentKeywords != null &&
                    argumentKeywords.TryGetValue(parameter.Name, out value))
                {
                    return(ConvertNamedParameter(formatter, parameter, value));
                }
                else if (parameter.HasDefaultValue)
                {
                    return(parameter.DefaultValue);
                }
                else
                {
                    throw NameError(parameter.Name);
                }
            }
        }
예제 #4
0
 private object ConvertParameter <TMessage>(IWampFormatter <TMessage> formatter, LocalParameter parameter, TMessage value)
 {
     return(formatter.Deserialize(parameter.Type, value));
 }