/// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            
            #line 10 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"

  // This creates a pre-compiled template that can be called from
  // within a project to generate C# wrappers for stored procedures.

  var helper = new ProcedureHelper();
  var meta = new MetaBuilder(sqlPaths.ToArray());
  meta.ProcedurePrefix = procedurePrefix ?? "";

/////////////////Begin Template//////////////////
 
            
            #line default
            #line hidden
            this.Write(@"// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by SqlSharpener.
//  
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace ");
            
            #line 28 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetNamespace(outputNamespace)));
            
            #line default
            #line hidden
            this.Write(@"
{
	using System;
	using System.IO;
	using System.Linq;
	using System.Data;
	using System.Data.SqlClient;
	using System.Configuration;
	using System.Collections.Generic;
	using Microsoft.SqlServer.Server;

	/// <summary>
	/// Interface of the wrapper class for calling stored procedures. 
	/// </summary>
	public partial interface IStoredProcedures
	{
");
            
            #line 44 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
foreach(var proc in meta.Procedures){ 
            
            #line default
            #line hidden
            this.Write("\t\t/// <summary>\r\n\t\t/// Calls the \"");
            
            #line 46 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));
            
            #line default
            #line hidden
            this.Write("\" stored procedure\r\n\t\t/// </summary>\r\n\t\t/// <returns>");
            
            #line 48 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));
            
            #line default
            #line hidden
            this.Write("</returns>\r\n\t\t");
            
            #line 49 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 49 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("( ");
            
            #line 49 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("InputDto input );\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Calls the \"");
            
            #line 52 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));
            
            #line default
            #line hidden
            this.Write("\" stored procedure using POCO objects\r\n\t\t/// </summary>\r\n\t\t/// <returns>");
            
            #line 54 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));
            
            #line default
            #line hidden
            this.Write("</returns>\r\n\t\tTPocoOutputDto ");
            
            #line 55 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("<TPocoOutputDto>( IProcedureInputDto input )\r\n\t\t\twhere TPocoOutputDto : IProcedur" +
                    "eOutputDto<");
            
            #line 56 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));
            
            #line default
            #line hidden
            this.Write(">, new();\r\n\r\n");
            
            #line 58 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 if(proc.Parameters.Any(x => x.IsTableValue)) { 
            
            #line default
            #line hidden
            this.Write("\t\t/// <summary>\r\n\t\t/// Calls the \"");
            
            #line 60 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));
            
            #line default
            #line hidden
            this.Write("\" stored procedure using generated objects for table-valued parameters.\r\n\t\t/// </" +
                    "summary>\r\n\t\t/// <returns>");
            
            #line 62 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));
            
            #line default
            #line hidden
            this.Write("</returns>\r\n\t\t");
            
            #line 63 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 63 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("( ");
            
            #line 63 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, false, true, false)));
            
            #line default
            #line hidden
            this.Write(" );\r\n");
            
            #line 64 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\r\n\t\t/// <summary>\r\n\t\t/// Calls the \"");
            
            #line 67 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));
            
            #line default
            #line hidden
            this.Write("\" stored procedure\r\n\t\t/// </summary>\r\n\t\t/// <returns>");
            
            #line 69 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));
            
            #line default
            #line hidden
            this.Write("</returns>\r\n\t\t");
            
            #line 70 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 70 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("( ");
            
            #line 70 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, true, true, false)));
            
            #line default
            #line hidden
            this.Write(" );\r\n\r\n");
            
            #line 72 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\t}\r\n\r\n\t/// <summary>\r\n\t/// Interface that a POCO can implement to be able to pass" +
                    " it in as the input DTO of a stored procedure\r\n\t/// if you prefer not to use the" +
                    " generated input dto. \r\n\t/// </summary>\r\n\tpublic partial interface IProcedureInp" +
                    "utDto\r\n\t{\r\n\t\t/// <summary>\r\n\t\t/// Converts the property values of the POCO into " +
                    "an array of objects.\r\n\t\t/// The order of values in the array should match the pa" +
                    "rameters of the \r\n\t\t/// stored procedure (excluding any output parameters).\r\n\t\t/" +
                    "// </summary>\r\n\t\tobject[] ToObjectArray();\r\n\r\n\t\t/// <summary>\r\n\t\t/// Sets proper" +
                    "ty values of the POCO with values from any output parameters\r\n\t\t/// of the store" +
                    "d procedure. Value will be passed in the same order as the \r\n\t\t/// output parame" +
                    "ters appear in the stored procedure.\r\n\t\t/// </summary>\r\n\t\tvoid SetFromOutputPara" +
                    "meters(object[] outputValues);\r\n\t}\r\n\r\n\t/// <summary>\r\n\t/// Interface that a POCO" +
                    " can implement to be used as the output DTO of a stored procedure\r\n\t/// if you p" +
                    "refer not to use the generated output dto. \r\n\t/// </summary>\r\n\tpublic partial in" +
                    "terface IProcedureOutputDto<TGeneratedOutput>\r\n\t{\r\n\t\t/// <summary>\r\n\t\t/// Sets p" +
                    "roperty values of the POCO with values from any output parameters\r\n\t\t/// of the " +
                    "stored procedure. Value will be passed in the same order as the \r\n\t\t/// output p" +
                    "arameters appear in the stored procedure.\r\n\t\t/// </summary>\r\n\t\tvoid SetFromResul" +
                    "t(TGeneratedOutput result);\r\n\t}\r\n\r\n\t/// <summary>\r\n\t/// Interface that a POCO ca" +
                    "n implement to be able to pass it into a table-valued parameter\r\n\t/// if you pre" +
                    "fer not to use the generated parameter dto. \r\n\t/// </summary>\r\n\tpublic partial i" +
                    "nterface ITableValuedParamRow\r\n\t{\r\n\t\tSqlDataRecord ToSqlDataRecord();\r\n\t}\r\n\r\n\t//" +
                    "/ <summary>\r\n\t/// Wrapper class for calling stored procedures. \r\n\t/// </summary>" +
                    "\r\n\tpublic partial class StoredProcedures : IStoredProcedures\r\n\t{\r\n\t\tprivate stri" +
                    "ng connectionString;\r\n\r\n\t\tpublic StoredProcedures(string connectionString)\r\n\t\t{\r" +
                    "\n\t\t\tthis.connectionString = connectionString;\r\n\t\t}\r\n\r\n\r\n");
            
            #line 132 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
foreach(var proc in meta.Procedures){ 
            
            #line default
            #line hidden
            this.Write("\t\t/// <summary>\r\n\t\t/// Calls the \"");
            
            #line 134 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));
            
            #line default
            #line hidden
            this.Write("\" stored procedure using a generated input DTO\r\n\t\t/// </summary>\r\n\t\t/// <returns>" +
                    "");
            
            #line 136 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));
            
            #line default
            #line hidden
            this.Write("</returns>\r\n\t\tpublic virtual ");
            
            #line 137 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 137 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("( ");
            
            #line 137 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("InputDto input )\r\n\t\t{\r\n");
            
            #line 139 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 foreach(var outputParam in proc.Parameters.Where(x => x.IsOutput)){ 
            
            #line default
            #line hidden
            this.Write("\t\t\t");
            
            #line 140 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.DataTypes[TypeFormat.DotNetFrameworkType]));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 140 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));
            
            #line default
            #line hidden
            this.Write("Output;\r\n");
            
            #line 141 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\t\t\tvar result = this.");
            
            #line 142 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 142 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamListForInputDto(proc)));
            
            #line default
            #line hidden
            this.Write(");\r\n");
            
            #line 143 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 foreach(var outputParam in proc.Parameters.Where(x => x.IsOutput)){ 
            
            #line default
            #line hidden
            this.Write("\t\t\tinput.");
            
            #line 144 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));
            
            #line default
            #line hidden
            this.Write(" = ");
            
            #line 144 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));
            
            #line default
            #line hidden
            this.Write("Output;\r\n");
            
            #line 145 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\t\t\treturn result;\r\n\t\t}\r\n\r\n\r\n\t\t/// <summary>\r\n\t\t/// Calls the \"");
            
            #line 151 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));
            
            #line default
            #line hidden
            this.Write("\" stored procedure using POCO objects\r\n\t\t/// </summary>\r\n\t\t/// <returns>");
            
            #line 153 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));
            
            #line default
            #line hidden
            this.Write("</returns>\r\n\t\tpublic virtual TPocoOutputDto ");
            
            #line 154 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("<TPocoOutputDto>( IProcedureInputDto input ) \r\n\t\t\twhere TPocoOutputDto : IProcedu" +
                    "reOutputDto<");
            
            #line 155 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));
            
            #line default
            #line hidden
            this.Write(">, new()\r\n\t\t{\r\n\t\t\tvar parameters = input.ToObjectArray();\r\n");
            
            #line 158 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 foreach(var outputParam in proc.Parameters.Where(x => x.IsOutput)){ 
            
            #line default
            #line hidden
            this.Write("\t\t\t");
            
            #line 159 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.DataTypes[TypeFormat.DotNetFrameworkType]));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 159 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));
            
            #line default
            #line hidden
            this.Write("Output;\r\n");
            
            #line 160 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\t\t\tvar result = this.");
            
            #line 161 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("(");
            
            #line 161 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamListForObjectArray(proc)));
            
            #line default
            #line hidden
            this.Write(");\r\n\t\t\tvar outputValues = new List<object>();\r\n");
            
            #line 163 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 foreach(var outputParam in proc.Parameters.Where(x => x.IsOutput)){ 
            
            #line default
            #line hidden
            this.Write("\t\t\toutputValues.Add(");
            
            #line 164 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));
            
            #line default
            #line hidden
            this.Write("Output);\r\n");
            
            #line 165 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\t\t\tinput.SetFromOutputParameters(outputValues.ToArray());\r\n\t\t\tvar outputPoco = ne" +
                    "w TPocoOutputDto();\r\n            outputPoco.SetFromResult(result);\r\n\t\t\treturn ou" +
                    "tputPoco;\r\n\t\t}\r\n\r\n");
            
            #line 172 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 if(proc.Parameters.Any(x => x.IsTableValue)) { 
            
            #line default
            #line hidden
            this.Write("\t\t/// <summary>\r\n\t\t/// Calls the \"");
            
            #line 174 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));
            
            #line default
            #line hidden
            this.Write("\" stored procedure using generated objects for table-valued parameters.\r\n\t\t/// </" +
                    "summary>\r\n\t\t/// <returns>");
            
            #line 176 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));
            
            #line default
            #line hidden
            this.Write("</returns>\r\n\t\tpublic virtual ");
            
            #line 177 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 177 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("( ");
            
            #line 177 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, false, true, false)));
            
            #line default
            #line hidden
            this.Write(" )\r\n\t\t{\r\n\t\t\treturn this.");
            
            #line 179 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("( ");
            
            #line 179 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, true, true, true)));
            
            #line default
            #line hidden
            this.Write(" );\r\n\t\t}\r\n");
            
            #line 181 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\r\n\t\t/// <summary>\r\n\t\t/// Calls the \"");
            
            #line 184 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));
            
            #line default
            #line hidden
            this.Write("\" stored procedure\r\n\t\t/// </summary>\r\n\t\t/// <returns>");
            
            #line 186 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));
            
            #line default
            #line hidden
            this.Write("</returns>\r\n\t\tpublic virtual ");
            
            #line 187 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));
            
            #line default
            #line hidden
            this.Write(" ");
            
            #line 187 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("( ");
            
            #line 187 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, true, true, false)));
            
            #line default
            #line hidden
            this.Write(" )\r\n\t\t{\r\n\t\t\tOn");
            
            #line 189 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("Begin();\r\n\t\t\t");
            
            #line 190 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnVariable(proc)));
            
            #line default
            #line hidden
            this.Write("\r\n\t\t\tusing(var conn = new SqlConnection(connectionString))\r\n\t\t\t{\r\n\t\t\t\tconn.Open()" +
                    ";\r\n\t\t\t\tusing (var cmd = conn.CreateCommand())\r\n\t\t\t\t{\r\n\t\t\t\t\tcmd.CommandType = Com" +
                    "mandType.StoredProcedure;\r\n\t\t\t\t\tcmd.CommandText = \"");
            
            #line 197 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));
            
            #line default
            #line hidden
            this.Write("\";\r\n");
            
            #line 198 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetSqlParamList(proc, 5)));
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 199 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetExecuteStatement(proc, 5)));
            
            #line default
            #line hidden
            this.Write("\r\n\t\t\t\t}\r\n\t\t\t\tconn.Close();\r\n\t\t\t}\r\n\t\t\tOn");
            
            #line 203 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("End(result);\r\n\t\t\treturn result;\r\n\t\t}\r\n\r\n\t\tpartial void On");
            
            #line 207 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("Begin();\r\n\t\tpartial void On");
            
            #line 208 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));
            
            #line default
            #line hidden
            this.Write("End(");
            
            #line 208 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));
            
            #line default
            #line hidden
            this.Write(" result);\r\n\r\n");
            
            #line 210 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 } 
            
            #line default
            #line hidden
            this.Write(@"
		/// <summary>
		/// Helper function to get the bytes out of varbinary columns
		/// </summary>
		private byte[] GetBytes(IDataReader reader, int ordinal)
		{
			MemoryStream ms = new MemoryStream();
			BinaryWriter writer = new BinaryWriter(ms);
			byte[] buffer = new byte[1024];
			long blobSize = reader.GetBytes(ordinal, 0, null, 0, 0);
			long currPos = 0;
			while (currPos < blobSize) {
				currPos += reader.GetBytes(ordinal, currPos, buffer, 0, 1024);
				writer.Write(buffer);
				writer.Flush();
			}
			writer.Close();
			return ms.ToArray();
		}
	}

	/// <summary>
	/// The return value of the stored procedure functions.
	/// </summary>
	public partial class Result<T>
	{
		public T Data { get; set; }
		public int RecordsAffected { get; set; }
	}

");
            
            #line 241 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
foreach(var proc in meta.Procedures){ 
            
            #line default
            #line hidden
            
            #line 242 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetDtoObject(proc, 1)));
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 243 "C:\Users\M139798\Source\Repos\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
 } 
            
            #line default
            #line hidden
            this.Write("}\r\n");
            return this.GenerationEnvironment.ToString();
        }
Beispiel #2
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            #line 10 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"

            // This creates a pre-compiled template that can be called from
            // within a project to generate C# wrappers for stored procedures.

            var helper = new ProcedureHelper();
            var meta   = new MetaBuilder(sqlPaths.ToArray());
            meta.ProcedurePrefix = procedurePrefix ?? "";

/////////////////Begin Template//////////////////


            #line default
            #line hidden
            this.Write(@"// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by SqlSharpener.
//  
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace ");

            #line 28 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetNamespace(outputNamespace)));

            #line default
            #line hidden
            this.Write(@"
{
	using System;
	using System.IO;
	using System.Linq;
	using System.Data;
	using System.Data.SqlClient;
	using System.Configuration;
	using System.Collections.Generic;
	using Microsoft.SqlServer.Server;

	/// <summary>
	/// Interface of the wrapper class for calling stored procedures. 
	/// </summary>
	public partial interface IStoredProcedures
	{
");

            #line 44 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            foreach (var proc in meta.Procedures)
            {
            #line default
            #line hidden
                this.Write("\t\t/// <summary>\r\n\t\t/// Calls the \"");

            #line 46 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));

            #line default
            #line hidden
                this.Write("\" stored procedure\r\n\t\t/// </summary>\r\n\t\t/// <returns>");

            #line 48 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));

            #line default
            #line hidden
                this.Write("</returns>\r\n\t\t");

            #line 49 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));

            #line default
            #line hidden
                this.Write(" ");

            #line 49 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("( ");

            #line 49 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("InputDto input );\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Calls the \"");

            #line 52 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));

            #line default
            #line hidden
                this.Write("\" stored procedure using POCO objects\r\n\t\t/// </summary>\r\n\t\t/// <returns>");

            #line 54 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));

            #line default
            #line hidden
                this.Write("</returns>\r\n\t\tTPocoOutputDto ");

            #line 55 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("<TPocoOutputDto>( IProcedureInputDto input )\r\n\t\t\twhere TPocoOutputDto : IProcedur" +
                           "eOutputDto<");

            #line 56 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));

            #line default
            #line hidden
                this.Write(">, new();\r\n\r\n");

            #line 58 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                if (proc.Parameters.Any(x => x.IsTableValue))
                {
            #line default
            #line hidden
                    this.Write("\t\t/// <summary>\r\n\t\t/// Calls the \"");

            #line 60 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));

            #line default
            #line hidden
                    this.Write("\" stored procedure using generated objects for table-valued parameters.\r\n\t\t/// </" +
                               "summary>\r\n\t\t/// <returns>");

            #line 62 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));

            #line default
            #line hidden
                    this.Write("</returns>\r\n\t\t");

            #line 63 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));

            #line default
            #line hidden
                    this.Write(" ");

            #line 63 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                    this.Write("( ");

            #line 63 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, false, true, false)));

            #line default
            #line hidden
                    this.Write(" );\r\n");

            #line 64 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                }

            #line default
            #line hidden
                this.Write("\r\n\t\t/// <summary>\r\n\t\t/// Calls the \"");

            #line 67 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));

            #line default
            #line hidden
                this.Write("\" stored procedure\r\n\t\t/// </summary>\r\n\t\t/// <returns>");

            #line 69 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));

            #line default
            #line hidden
                this.Write("</returns>\r\n\t\t");

            #line 70 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));

            #line default
            #line hidden
                this.Write(" ");

            #line 70 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("( ");

            #line 70 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, true, true, false)));

            #line default
            #line hidden
                this.Write(" );\r\n\r\n");

            #line 72 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            }

            #line default
            #line hidden
            this.Write("\t}\r\n\r\n\t/// <summary>\r\n\t/// Interface that a POCO can implement to be able to pass" +
                       " it in as the input DTO of a stored procedure\r\n\t/// if you prefer not to use the" +
                       " generated input dto. \r\n\t/// </summary>\r\n\tpublic partial interface IProcedureInp" +
                       "utDto\r\n\t{\r\n\t\t/// <summary>\r\n\t\t/// Converts the property values of the POCO into " +
                       "an array of objects.\r\n\t\t/// The order of values in the array should match the pa" +
                       "rameters of the \r\n\t\t/// stored procedure (excluding any output parameters).\r\n\t\t/" +
                       "// </summary>\r\n\t\tobject[] ToObjectArray();\r\n\r\n\t\t/// <summary>\r\n\t\t/// Sets proper" +
                       "ty values of the POCO with values from any output parameters\r\n\t\t/// of the store" +
                       "d procedure. Value will be passed in the same order as the \r\n\t\t/// output parame" +
                       "ters appear in the stored procedure.\r\n\t\t/// </summary>\r\n\t\tvoid SetFromOutputPara" +
                       "meters(object[] outputValues);\r\n\t}\r\n\r\n\t/// <summary>\r\n\t/// Interface that a POCO" +
                       " can implement to be used as the output DTO of a stored procedure\r\n\t/// if you p" +
                       "refer not to use the generated output dto. \r\n\t/// </summary>\r\n\tpublic partial in" +
                       "terface IProcedureOutputDto<TGeneratedOutput>\r\n\t{\r\n\t\t/// <summary>\r\n\t\t/// Sets p" +
                       "roperty values of the POCO with values from any output parameters\r\n\t\t/// of the " +
                       "stored procedure. Value will be passed in the same order as the \r\n\t\t/// output p" +
                       "arameters appear in the stored procedure.\r\n\t\t/// </summary>\r\n\t\tvoid SetFromResul" +
                       "t(TGeneratedOutput result);\r\n\t}\r\n\r\n\t/// <summary>\r\n\t/// Interface that a POCO ca" +
                       "n implement to be able to pass it into a table-valued parameter\r\n\t/// if you pre" +
                       "fer not to use the generated parameter dto. \r\n\t/// </summary>\r\n\tpublic partial i" +
                       "nterface ITableValuedParamRow\r\n\t{\r\n\t\tSqlDataRecord ToSqlDataRecord();\r\n\t}\r\n\r\n\t//" +
                       "/ <summary>\r\n\t/// Wrapper class for calling stored procedures. \r\n\t/// </summary>" +
                       "\r\n\tpublic partial class StoredProcedures : IStoredProcedures\r\n\t{\r\n\t\tprivate stri" +
                       "ng connectionString;\r\n\r\n\t\tpublic StoredProcedures(string connectionString)\r\n\t\t{\r" +
                       "\n\t\t\tthis.connectionString = connectionString;\r\n\t\t}\r\n\r\n\r\n");

            #line 132 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            foreach (var proc in meta.Procedures)
            {
            #line default
            #line hidden
                this.Write("\t\t/// <summary>\r\n\t\t/// Calls the \"");

            #line 134 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));

            #line default
            #line hidden
                this.Write("\" stored procedure using a generated input DTO\r\n\t\t/// </summary>\r\n\t\t/// <returns>" +
                           "");

            #line 136 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));

            #line default
            #line hidden
                this.Write("</returns>\r\n\t\tpublic virtual ");

            #line 137 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));

            #line default
            #line hidden
                this.Write(" ");

            #line 137 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("( ");

            #line 137 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("InputDto input )\r\n\t\t{\r\n");

            #line 139 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                foreach (var outputParam in proc.Parameters.Where(x => x.IsOutput))
                {
            #line default
            #line hidden
                    this.Write("\t\t\t");

            #line 140 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.DataTypes[TypeFormat.DotNetFrameworkType]));

            #line default
            #line hidden
                    this.Write(" ");

            #line 140 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));

            #line default
            #line hidden
                    this.Write("Output;\r\n");

            #line 141 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                }

            #line default
            #line hidden
                this.Write("\t\t\tvar result = this.");

            #line 142 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("(");

            #line 142 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamListForInputDto(proc)));

            #line default
            #line hidden
                this.Write(");\r\n");

            #line 143 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                foreach (var outputParam in proc.Parameters.Where(x => x.IsOutput))
                {
            #line default
            #line hidden
                    this.Write("\t\t\tinput.");

            #line 144 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));

            #line default
            #line hidden
                    this.Write(" = ");

            #line 144 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));

            #line default
            #line hidden
                    this.Write("Output;\r\n");

            #line 145 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                }

            #line default
            #line hidden
                this.Write("\t\t\treturn result;\r\n\t\t}\r\n\r\n\r\n\t\t/// <summary>\r\n\t\t/// Calls the \"");

            #line 151 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));

            #line default
            #line hidden
                this.Write("\" stored procedure using POCO objects\r\n\t\t/// </summary>\r\n\t\t/// <returns>");

            #line 153 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));

            #line default
            #line hidden
                this.Write("</returns>\r\n\t\tpublic virtual TPocoOutputDto ");

            #line 154 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("<TPocoOutputDto>( IProcedureInputDto input ) \r\n\t\t\twhere TPocoOutputDto : IProcedu" +
                           "reOutputDto<");

            #line 155 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));

            #line default
            #line hidden
                this.Write(">, new()\r\n\t\t{\r\n\t\t\tvar parameters = input.ToObjectArray();\r\n");

            #line 158 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                foreach (var outputParam in proc.Parameters.Where(x => x.IsOutput))
                {
            #line default
            #line hidden
                    this.Write("\t\t\t");

            #line 159 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.DataTypes[TypeFormat.DotNetFrameworkType]));

            #line default
            #line hidden
                    this.Write(" ");

            #line 159 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));

            #line default
            #line hidden
                    this.Write("Output;\r\n");

            #line 160 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                }

            #line default
            #line hidden
                this.Write("\t\t\tvar result = this.");

            #line 161 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("(");

            #line 161 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamListForObjectArray(proc)));

            #line default
            #line hidden
                this.Write(");\r\n\t\t\tvar outputValues = new List<object>();\r\n");

            #line 163 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                foreach (var outputParam in proc.Parameters.Where(x => x.IsOutput))
                {
            #line default
            #line hidden
                    this.Write("\t\t\toutputValues.Add(");

            #line 164 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(outputParam.Name));

            #line default
            #line hidden
                    this.Write("Output);\r\n");

            #line 165 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                }

            #line default
            #line hidden
                this.Write("\t\t\tinput.SetFromOutputParameters(outputValues.ToArray());\r\n\t\t\tvar outputPoco = ne" +
                           "w TPocoOutputDto();\r\n            outputPoco.SetFromResult(result);\r\n\t\t\treturn ou" +
                           "tputPoco;\r\n\t\t}\r\n\r\n");

            #line 172 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                if (proc.Parameters.Any(x => x.IsTableValue))
                {
            #line default
            #line hidden
                    this.Write("\t\t/// <summary>\r\n\t\t/// Calls the \"");

            #line 174 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));

            #line default
            #line hidden
                    this.Write("\" stored procedure using generated objects for table-valued parameters.\r\n\t\t/// </" +
                               "summary>\r\n\t\t/// <returns>");

            #line 176 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));

            #line default
            #line hidden
                    this.Write("</returns>\r\n\t\tpublic virtual ");

            #line 177 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));

            #line default
            #line hidden
                    this.Write(" ");

            #line 177 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                    this.Write("( ");

            #line 177 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, false, true, false)));

            #line default
            #line hidden
                    this.Write(" )\r\n\t\t{\r\n\t\t\treturn this.");

            #line 179 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                    this.Write("( ");

            #line 179 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, true, true, true)));

            #line default
            #line hidden
                    this.Write(" );\r\n\t\t}\r\n");

            #line 181 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                }

            #line default
            #line hidden
                this.Write("\r\n\t\t/// <summary>\r\n\t\t/// Calls the \"");

            #line 184 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));

            #line default
            #line hidden
                this.Write("\" stored procedure\r\n\t\t/// </summary>\r\n\t\t/// <returns>");

            #line 186 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnXmlComment(proc)));

            #line default
            #line hidden
                this.Write("</returns>\r\n\t\tpublic virtual ");

            #line 187 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));

            #line default
            #line hidden
                this.Write(" ");

            #line 187 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("( ");

            #line 187 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetMethodParamList(proc, true, true, false)));

            #line default
            #line hidden
                this.Write(" )\r\n\t\t{\r\n\t\t\tOn");

            #line 189 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("Begin();\r\n\t\t\t");

            #line 190 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnVariable(proc)));

            #line default
            #line hidden
                this.Write("\r\n\t\t\tusing(var conn = new SqlConnection(connectionString))\r\n\t\t\t{\r\n\t\t\t\tconn.Open()" +
                           ";\r\n\t\t\t\tusing (var cmd = conn.CreateCommand())\r\n\t\t\t\t{\r\n\t\t\t\t\tcmd.CommandType = Com" +
                           "mandType.StoredProcedure;\r\n\t\t\t\t\tcmd.CommandText = \"");

            #line 197 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.RawName));

            #line default
            #line hidden
                this.Write("\";\r\n");

            #line 198 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetSqlParamList(proc, 5)));

            #line default
            #line hidden
                this.Write("\r\n");

            #line 199 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetExecuteStatement(proc, 5)));

            #line default
            #line hidden
                this.Write("\r\n\t\t\t\t}\r\n\t\t\t\tconn.Close();\r\n\t\t\t}\r\n\t\t\tOn");

            #line 203 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("End(result);\r\n\t\t\treturn result;\r\n\t\t}\r\n\r\n\t\tpartial void On");

            #line 207 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("Begin();\r\n\t\tpartial void On");

            #line 208 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(proc.Name));

            #line default
            #line hidden
                this.Write("End(");

            #line 208 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetReturnType(proc)));

            #line default
            #line hidden
                this.Write(" result);\r\n\r\n");

            #line 210 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            }

            #line default
            #line hidden
            this.Write(@"
		/// <summary>
		/// Helper function to get the bytes out of varbinary columns
		/// </summary>
		private byte[] GetBytes(IDataReader reader, int ordinal)
		{
			MemoryStream ms = new MemoryStream();
			BinaryWriter writer = new BinaryWriter(ms);
			byte[] buffer = new byte[1024];
			long blobSize = reader.GetBytes(ordinal, 0, null, 0, 0);
			long currPos = 0;
			while (currPos < blobSize) {
				currPos += reader.GetBytes(ordinal, currPos, buffer, 0, 1024);
				writer.Write(buffer);
				writer.Flush();
			}
			writer.Close();
			return ms.ToArray();
		}
	}

	/// <summary>
	/// The return value of the stored procedure functions.
	/// </summary>
	public partial class Result<T>
	{
		public T Data { get; set; }
		public int RecordsAffected { get; set; }
	}

");

            #line 241 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            foreach (var proc in meta.Procedures)
            {
            #line default
            #line hidden

            #line 242 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(helper.GetDtoObject(proc, 1)));

            #line default
            #line hidden
                this.Write("\r\n");

            #line 243 "C:\projects\GitHub\sqlsharpener\src\SqlSharpener\StoredProceduresTemplate.tt"
            }

            #line default
            #line hidden
            this.Write("}\r\n");
            return(this.GenerationEnvironment.ToString());
        }