Example #1
0
        public bool AddFieldParameter(string fieldParameter, object value)
        {
            string str = null;
            bool   flag;

            fieldParameter.ThrowIfNullOrEmpty("fieldParameter", Resources.FieldParameterNullOrEmpty, new object[0]);
            if (this.cmdletInfo.FieldParameterMapping.TryGetValue(fieldParameter, out str))
            {
                if (this.IsNullValueAllowedForField(fieldParameter) || value != null)
                {
                    try
                    {
                        this.AddParameterInternal(str, value, false);
                        flag = true;
                    }
                    catch (ArgumentException argumentException1)
                    {
                        ArgumentException argumentException = argumentException1;
                        argumentException.Trace("Ignoring exception in AddFieldParameter");
                        flag = false;
                    }
                    return(flag);
                }
                else
                {
                    throw new ArgumentException(Resources.NullValueNotAllowedForNonNullableProperty, fieldParameter);
                }
            }
            else
            {
                TraceHelper.Current.DebugMessage(string.Concat("Field parameter", fieldParameter, " not found in list of FieldParameterMapping for cmdlet ", this.cmdletInfo.CmdletName));
                return(false);
            }
        }
Example #2
0
 public void AddReferringObject(Dictionary <string, object> keys)
 {
     foreach (KeyValuePair <string, object> key in keys)
     {
         string item = this.referenceCmdletInfo.ReferringObjectParameterMapping[key.Key];
         try
         {
             base.AddParameterInternal(item, key.Value, false);
         }
         catch (ArgumentException argumentException1)
         {
             ArgumentException argumentException = argumentException1;
             argumentException.Trace("Ignoring exception in AddReferringObject");
         }
     }
 }