public void SetInputParameters(ICustomOperation customOperation, Dictionary <string, string> requestParameters) { if (requestParameters == null || requestParameters.Count <= 0) { return; } Type objectType = customOperation.GetType(); foreach (var parameter in requestParameters) { PropertyInfo propertyInfo = objectType.GetProperty(parameter.Key); if (IsInputParameters(propertyInfo)) { propertyInfo.SetValue(customOperation, Convert.ChangeType(parameter.Value, propertyInfo.PropertyType)); } } }
public Dictionary <string, string> GetOutputParameters(ICustomOperation customOperation) { Dictionary <string, string> outputs = new Dictionary <string, string>(); foreach (PropertyInfo prop in customOperation.GetType().GetProperties()) { object[] attrs = prop.GetCustomAttributes(true); foreach (object attr in attrs) { if (attr is VariableMappingAttribute) { object retObj = prop.GetValue(customOperation); string retStr = retObj != null?Convert.ToString(retObj) : string.Empty; outputs.Add(prop.Name, retStr); } } } return(outputs); }