/// <summary> /// Gets the parameter list for the method. /// </summary> /// <param name="proc">The procedure to get the parameter list for.</param> /// <param name="genericTableValue">if set to <c>true</c> [generic table value].</param> /// <param name="includeType">if set to <c>true</c> [include type].</param> /// <param name="convertType">if set to <c>true</c> [convert type].</param> /// <returns> /// The generated parameter list. /// </returns> public string GetMethodParamList(Procedure proc, bool genericTableValue, bool includeType, bool convertType) { var b = new TextBuilder(); for (var i = 0; i < proc.Parameters.Count(); i++) { var parameter = proc.Parameters.ElementAt(i); if (i != 0) { b.Append(", "); } if (parameter.IsTableValue) { if (includeType) { if (genericTableValue) { var format = convertType ? "(IEnumerable<ITableValuedParamRow>){0}" : "IEnumerable<ITableValuedParamRow> {0}"; b.AppendFormat(format, parameter.Name); } else { var format = convertType ? "(IEnumerable<{0}_{1}ParamDto>){1}" : "IEnumerable<{0}_{1}ParamDto> {1}"; b.AppendFormat(format, proc.Name, parameter.Name); } } else { b.Append(parameter.Name); } } else { if (parameter.IsOutput) { b.Append("out "); } if (includeType) { var format = convertType ? "({0}){1}" : "{0} {1}"; b.AppendFormat(format, parameter.DataTypes[TypeFormat.DotNetFrameworkType], parameter.Name); } else { b.Append(parameter.Name); } } } return(b.ToString()); }
/// <summary> /// Gets the method parameter list for object array. /// </summary> /// <param name="proc">The proc.</param> /// <returns></returns> public string GetMethodParamListForObjectArray(Procedure proc) { var b = new TextBuilder(); var objectIndex = 0; for (var i = 0; i < proc.Parameters.Count(); i++) { var parameter = proc.Parameters.ElementAt(i); if (i != 0) { b.Append(", "); } if (parameter.IsOutput) { b.AppendFormat("out {0}Output", parameter.Name); } else { if (parameter.IsTableValue) { b.AppendFormat("(IEnumerable<ITableValuedParamRow>)parameters[{0}]", objectIndex.ToString()); } else { b.AppendFormat("({1})parameters[{0}]", objectIndex.ToString(), parameter.DataTypes[TypeFormat.DotNetFrameworkType]); } objectIndex++; } } return(b.ToString()); }
/// <summary> /// Gets the method parameter list for methods that call an overload /// with input DTO properties as parameters. /// </summary> /// <param name="proc">The proc.</param> /// <returns></returns> public string GetMethodParamListForInputDto(Procedure proc) { var b = new TextBuilder(); for (var i = 0; i < proc.Parameters.Count(); i++) { var parameter = proc.Parameters.ElementAt(i); if (i != 0) { b.Append(", "); } b.AppendFormat(parameter.IsOutput ? "out {0}Output" : "input.{0}", parameter.Name); } return(b.ToString()); }
/// <summary> /// Gets the method parameter list for object array. /// </summary> /// <param name="proc">The proc.</param> /// <returns></returns> public string GetMethodParamListForObjectArray(Procedure proc) { var b = new TextBuilder(); var objectIndex = 0; for (var i = 0; i < proc.Parameters.Count(); i++) { var parameter = proc.Parameters.ElementAt(i); if (i != 0) b.Append(", "); if (parameter.IsOutput) b.AppendFormat("out {0}Output", parameter.Name); else { if (parameter.IsTableValue) { b.AppendFormat("(IEnumerable<ITableValuedParamRow>)parameters[{0}]", objectIndex.ToString()); } else { b.AppendFormat("({1})parameters[{0}]", objectIndex.ToString(), parameter.DataTypes[TypeFormat.DotNetFrameworkType]); } objectIndex++; } } return b.ToString(); }
/// <summary> /// Gets the method parameter list for methods that call an overload /// with input DTO properties as parameters. /// </summary> /// <param name="proc">The proc.</param> /// <returns></returns> public string GetMethodParamListForInputDto(Procedure proc) { var b = new TextBuilder(); for (var i = 0; i < proc.Parameters.Count(); i++) { var parameter = proc.Parameters.ElementAt(i); if (i != 0) b.Append(", "); b.AppendFormat(parameter.IsOutput ? "out {0}Output" : "input.{0}", parameter.Name); } return b.ToString(); }
/// <summary> /// Gets the parameter list for the method. /// </summary> /// <param name="proc">The procedure to get the parameter list for.</param> /// <param name="genericTableValue">if set to <c>true</c> [generic table value].</param> /// <param name="includeType">if set to <c>true</c> [include type].</param> /// <param name="convertType">if set to <c>true</c> [convert type].</param> /// <returns> /// The generated parameter list. /// </returns> public string GetMethodParamList(Procedure proc, bool genericTableValue, bool includeType, bool convertType) { var b = new TextBuilder(); for (var i = 0; i < proc.Parameters.Count(); i++) { var parameter = proc.Parameters.ElementAt(i); if (i != 0) b.Append(", "); if (parameter.IsTableValue) { if (includeType) { if (genericTableValue) { var format = convertType ? "(IEnumerable<ITableValuedParamRow>){0}" : "IEnumerable<ITableValuedParamRow> {0}"; b.AppendFormat(format, parameter.Name); } else { var format = convertType ? "(IEnumerable<{0}_{1}ParamDto>){1}" : "IEnumerable<{0}_{1}ParamDto> {1}"; b.AppendFormat(format, proc.Name, parameter.Name); } } else b.Append(parameter.Name); } else { if (parameter.IsOutput) b.Append("out "); if (includeType) { var format = convertType ? "({0}){1}" : "{0} {1}"; b.AppendFormat(format, parameter.DataTypes[TypeFormat.DotNetFrameworkType], parameter.Name); } else b.Append(parameter.Name); } } return b.ToString(); }