private void MapOutPutMappingToActivityResult(FuzeActivity container, FuzeActivity currentActivity, Contracts.ActivityResult activityResult) { if (currentActivity.OutputMappings != null) { foreach (Mapping mapping in currentActivity.OutputMappings) { PropertyInfo propertyInfo = container.GetType().GetProperty(mapping.MappingArgument); activityResult.Results.Add(mapping.MappingArgument, propertyInfo.GetValue(container)); } } }
private void SetOutputMappingsToWorkFlow(FuzeActivity container, FuzeActivity currentActivity) { if (currentActivity.OutputMappings != null) { foreach (Mapping mapping in currentActivity.OutputMappings) { PropertyInfo propertyInfo = container.GetType().GetProperty(mapping.MappingArgument); propertyInfo.SetValue(container, Convert.ChangeType(currentActivity.GetType().GetProperty(mapping.InputArgument).GetValue(currentActivity, null), propertyInfo.PropertyType), null); } } }
private void MapInputParameters(Contracts.ActivityInput input, FuzeActivity activity) { if (input.Inputs != null) { // get all input properties of the workflow. var properties = activity.GetType().GetProperties() .Where(prop => prop.IsDefined(typeof(InputAttribute), false)); foreach (var property in properties) { if (input.Inputs[property.Name] != null) { property.SetValue(activity, Convert.ChangeType(input.Inputs[property.Name], property.PropertyType), null); } } } }