Example #1
0
        public static ParameterSettings RemoveParameterLinks(this ParameterSettings parameterSettings, Type type, IEnumerable <string> propertyNames)
        {
            if (parameterSettings == null)
            {
                return(null);
            }

            if (type == null || propertyNames == null || propertyNames.Count() == 0)
            {
                return(parameterSettings);
            }

            ParameterMap parameterMap = parameterSettings.ParameterMaps.Find(x => x.Type == type);

            if (parameterMap == null)
            {
                return(parameterSettings);
            }

            ParameterSettings cloneSettings = parameterSettings.ShallowClone();

            cloneSettings.ParameterMaps = new List <ParameterMap>(parameterSettings.ParameterMaps);
            cloneSettings.ParameterMaps.Remove(parameterMap);
            cloneSettings.ParameterMaps.Add(parameterMap.RemoveParameterLinks(propertyNames));
            return(cloneSettings);
        }