Example #1
0
 /// <summary>
 /// Performs a deep clone of a parameter mapping.
 /// </summary>
 /// <returns>A deep clone of current object.</returns>
 public object Clone()
 {
     ParameterMapping mapping = new ParameterMapping();
     mapping.InputParameter = (Parameter)this.InputParameter.Clone();
     mapping.InputParameterProperty = this.InputParameterProperty;
     mapping.OutputParameterProperty = this.OutputParameterProperty;
     return mapping;
 }
Example #2
0
        /// <summary>
        /// Performs a deep clone of a parameter mapping.
        /// </summary>
        /// <returns>A deep clone of current object.</returns>
        public object Clone()
        {
            ParameterMapping mapping = new ParameterMapping();

            mapping.InputParameter          = (Parameter)this.InputParameter.Clone();
            mapping.InputParameterProperty  = this.InputParameterProperty;
            mapping.OutputParameterProperty = this.OutputParameterProperty;
            return(mapping);
        }
        private static string GetMapping(ParameterMapping mapping, bool filterRequired = false)
        {
            string inputPath = mapping.InputParameter.Name;
            if (mapping.InputParameterProperty != null)
            {
                inputPath += "." + CodeNamer.CamelCase(mapping.InputParameterProperty) + "()";
            }
            if (filterRequired && !mapping.InputParameter.IsRequired)
            {
                inputPath = "null";
            }

            string outputPath = "";
            if (mapping.OutputParameterProperty != null)
            {
                outputPath += ".with" + CodeNamer.PascalCase(mapping.OutputParameterProperty);
                return string.Format(CultureInfo.InvariantCulture, "{0}({1})", outputPath, inputPath);
            }
            else
            {
                return string.Format(CultureInfo.InvariantCulture, "{0} = {1}", outputPath, inputPath);
            }
        }