private static void SetActionInputPropertyValues(ActionInfo actionDefinition, IAction action, Dictionary<string, object> propertyCache) { foreach (var property in actionDefinition.InputProperties) { var propertyInfo = GetSetPropertyInfo(action.GetType(), property.Name, actionDefinition.Id); object expandedValue; try { expandedValue = ExpandMacros(property.Value, propertyCache); } catch (Exception e) { var message = string.Format("Can't expand macros for property '{0}' in action '{1}'. {2}", property.Name, actionDefinition.Id, e.Message); throw new InvalidDataException(message, e); } if (!propertyInfo.PropertyType.IsInstanceOfType(expandedValue)) { expandedValue = Convert.ChangeType(expandedValue, propertyInfo.PropertyType); } propertyInfo.SetValue(action, expandedValue); } }
private static void GetActionOutputPropertyValues(ActionInfo actionDefinition, IAction action, Dictionary<string, object> propertyCache) { foreach (var outPropertyRow in actionDefinition.OutputProperties) { var propertyName = outPropertyRow.Name; var propertyInfo = GetGetPropertyInfo(action.GetType(), propertyName, actionDefinition.Id); var propertyValue = propertyInfo.GetValue(action); propertyCache.Add(GetPropertyMacroName(actionDefinition.Id, propertyName), propertyValue); } }