public override void GenerateCode(IFunctionBuilder functionBuilder) { bool closeFileHandle = FunctionData.Properties.ContainsKey(FileShared.OwnsFileHandlePropertyName) ? FunctionData.Properties[FileShared.OwnsFileHandlePropertyName].GetValue <bool>() : true; functionBuilder.AddCode(String.Format( @"var fileHandle = (Twenty57.Linx.Components.File.Common.BinaryFileHandle){0};{1} return Twenty57.Linx.Components.File.BinaryFileWriteX.WriteFile( fileHandle, {2}, {3}, {4}, {5}, message => {6}.Log(message) );" , functionBuilder.GetParamName(FileShared.FilePathPropertyName), closeFileHandle ? string.Format("{0}fileHandle.LogEvent += message => {1}.Log(message);", Environment.NewLine, functionBuilder.ContextParamName) : string.Empty, CSharpUtilities.BoolAsString(closeFileHandle), functionBuilder.GetParamName(BinaryFileWriteShared.ContentsPropertyName), CSharpUtilities.EnumAsString(FunctionData.Properties[BinaryFileWriteShared.FileDoesNotExistPropertyName].Value), CSharpUtilities.EnumAsString(FunctionData.Properties[BinaryFileWriteShared.FileExistsPropertyName].Value), functionBuilder.ContextParamName )); functionBuilder.AddAssemblyReference(typeof(BinaryFileWriteX)); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("\r\n"); this.Write("\r\nvar beginTransactionX = new Twenty57.Linx.Components.Database.BeginTransaction." + "BeginTransactionX(\r\n\t"); #line 12 "D:\Hg\Linx5 Components\Database\Code\Database\BeginTransaction\BeginTransaction_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(ConnectionType))); #line default #line hidden this.Write(",\r\n\t"); #line 13 "D:\Hg\Linx5 Components\Database\Code\Database\BeginTransaction\BeginTransaction_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ConnectionStringPropertyName)); #line default #line hidden this.Write(",\r\n\tSystem.Data.IsolationLevel."); #line 14 "D:\Hg\Linx5 Components\Database\Code\Database\BeginTransaction\BeginTransaction_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(IsolationLevelName)); #line default #line hidden this.Write(");\r\nbeginTransactionX.Transaction.LogEvent += message => "); #line 15 "D:\Hg\Linx5 Components\Database\Code\Database\BeginTransaction\BeginTransaction_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(FunctionContextProperty)); #line default #line hidden this.Write(".Log(message);\r\n"); #line 16 "D:\Hg\Linx5 Components\Database\Code\Database\BeginTransaction\BeginTransaction_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ExecutionPathOutputName)); #line default #line hidden this.Write(" = beginTransactionX.Select(transaction => new Twenty57.Linx.Plugin.Common.CodeGe" + "neration.NextResult("); #line 16 "D:\Hg\Linx5 Components\Database\Code\Database\BeginTransaction\BeginTransaction_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ToVerbatimString(ExecutionPathName))); #line default #line hidden this.Write(", transaction));\r\n"); return(this.GenerationEnvironment.ToString()); }
public override void GenerateCode(IFunctionBuilder functionBuilder) { RobocopyShared.ModeOption modeOption = FunctionData.Properties[RobocopyShared.ModePropertyName].GetValue <RobocopyShared.ModeOption>(); functionBuilder.AddCode(string.Format("Twenty57.Linx.Components.File.RobocopyX.Execute({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31},{32},{33},{34},{35},{36},{37},{38},message => {39}.Log(message));", functionBuilder.GetParamName(RobocopyShared.SourceDirectoryPropertyName) , functionBuilder.GetParamName(RobocopyShared.TargetDirectoryPropertyName) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.CopySubdirectoriesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.IncludeEmptySubdirectoriesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.RestartModePropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.BackupModePropertyName].GetValue <bool>()) , functionBuilder.GetParamName(RobocopyShared.NumberOfRetriesPropertyName) , functionBuilder.GetParamName(RobocopyShared.TimeBetweenRetriesPropertyName) , functionBuilder.GetParamName(RobocopyShared.FilePatternPropertyName) , functionBuilder.GetParamName(RobocopyShared.ExcludeFilesPropertyName) , functionBuilder.GetParamName(RobocopyShared.ExcludeDirectoriesPropertyName) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludesChangedFilesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludesNewerFilesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludesOlderFilesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludesExtraFilesAndDirectoriesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludesLonelyFilesAndDirectoriesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.IncludesSameFilesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.IncludesTweakedFilesPropertyName].GetValue <bool>()) , functionBuilder.GetParamName(RobocopyShared.MaxFileSizePropertyName) , functionBuilder.GetParamName(RobocopyShared.MinFileSizePropertyName) , functionBuilder.GetParamName(RobocopyShared.MaxAgePropertyName) , functionBuilder.GetParamName(RobocopyShared.MinAgePropertyName) , functionBuilder.GetParamName(RobocopyShared.MaxLastAccessDatePropertyName) , functionBuilder.GetParamName(RobocopyShared.MinLastAccessDatePropertyName) , functionBuilder.GetParamName(RobocopyShared.LogFilePropertyName) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.OverwriteFilePropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ListFilesOnlyPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.LogAllExtraFilesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.VerbosePropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.IncludeSourceFileTimestampsPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.IncludeFullPathPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.LogSizeAsBytesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludeFileSizePropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludeFileClassPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludeFileNamesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludeDirectoryNamesPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.ExcludeProgressPropertyName].GetValue <bool>()) , CSharpUtilities.BoolAsString(FunctionData.Properties[RobocopyShared.IncludeETAPropertyName].GetValue <bool>()) , CSharpUtilities.EnumAsString(modeOption) , functionBuilder.ContextParamName)); functionBuilder.AddAssemblyReference(typeof(Robocopy)); }
public override void GenerateCode(Plugin.Common.CodeGeneration.IFunctionBuilder functionBuilder) { functionBuilder.AddCode( string.Format(@"var executor = new Twenty57.Linx.Components.File.V1.DirectoryOperationsX(); executor.LogEvent += message => {0}.Log(message);" , functionBuilder.ContextParamName)); DirectoryOperationsShared.ActionType actionType = FunctionData.Properties[DirectoryOperationsShared.ActionPropertyName].GetValue <DirectoryOperationsShared.ActionType>(); switch (actionType) { case DirectoryOperationsShared.ActionType.DirectoryExists: functionBuilder.AddCode(string.Format("return executor.DirectoryExists({0});", functionBuilder.GetParamName(DirectoryOperationsShared.DirectoryPropertyName))); break; case DirectoryOperationsShared.ActionType.Create: functionBuilder.AddCode(string.Format("return executor.CreateDirectory({0}, {1});", functionBuilder.GetParamName(DirectoryOperationsShared.DirectoryPropertyName), CSharpUtilities.EnumAsString(FunctionData.Properties[DirectoryOperationsShared.CreateDirectoryExistsPropertyName].GetValue <DirectoryOperationsShared.CreateExistsOption>()))); break; case DirectoryOperationsShared.ActionType.Delete: functionBuilder.AddCode(string.Format("executor.DeleteDirectory({0});", functionBuilder.GetParamName(DirectoryOperationsShared.DirectoryPropertyName))); break; case DirectoryOperationsShared.ActionType.Copy: case DirectoryOperationsShared.ActionType.Move: functionBuilder.AddCode(string.Format(@"executor.CopyOrMove({0}, {1}, {2}, {3}, {4});", CSharpUtilities.EnumAsString(actionType), functionBuilder.GetParamName(DirectoryOperationsShared.SourceDirectoryPropertyName), functionBuilder.GetParamName(DirectoryOperationsShared.TargetDirectoryPropertyName), CSharpUtilities.EnumAsString(FunctionData.Properties[DirectoryOperationsShared.DirectoryExistsPropertyName].GetValue <DirectoryOperationsShared.ExistsOption>()), CSharpUtilities.BoolAsString(FunctionData.Properties[DirectoryOperationsShared.ReplaceExistingFilePropertyName].GetValue <bool>()))); break; default: throw new Exception(string.Format("Invalid action type [{0}] specified.", actionType)); } functionBuilder.AddAssemblyReference(typeof(DirectoryOperations)); }
public override void GenerateCode(IFunctionBuilder functionBuilder) { FileOperationsShared.ActionType actionType = FunctionData.Properties[FileOperationsShared.ActionPropertyName].GetValue <FileOperationsShared.ActionType>(); FileOperationsShared.ExistsOption existsOption = FunctionData.Properties[FileOperationsShared.FileExistsPropertyName].GetValue <FileOperationsShared.ExistsOption>(); if (actionType == FileOperationsShared.ActionType.FileExists) { functionBuilder.AddCode(string.Format( @"bool exists = Twenty57.Linx.Components.File.FileOperationsX.FileExists({0}); {1}.Log(System.String.Format(""File {{0}} {{1}}"", {0}, exists ? ""exists."" : ""does not exist."")); return exists;" , functionBuilder.GetParamName(FileOperationsShared.SourceFilePathPropertyName), functionBuilder.ContextParamName)); } else if (actionType == FileOperationsShared.ActionType.CreateTempFile) { functionBuilder.AddCode(string.Format( @"string tempFilePath = Twenty57.Linx.Components.File.FileOperationsX.CreateTempFile(); {0}.Log(System.String.Format(""Temp file created at {{0}}."", tempFilePath)); return tempFilePath;" , functionBuilder.ContextParamName)); } else { bool keepFileName = FunctionData.Properties.ContainsKey(FileOperationsShared.KeepFileNamePropertyName) ? FunctionData.Properties[FileOperationsShared.KeepFileNamePropertyName].GetValue <bool>() : true; functionBuilder.AddCode(string.Format(@"string destinationFilePath = Twenty57.Linx.Components.File.FileOperationsX.Execute({0}, {1}, {2}, {3}, {4}, message => {5}.Log(message));" , functionBuilder.GetParamName(FileOperationsShared.SourceFilePathPropertyName) , CSharpUtilities.BoolAsString(keepFileName) , functionBuilder.GetParamName(keepFileName ? FileOperationsShared.DestinationFolderPathPropertyName : FileOperationsShared.DestinationFilePathPropertyName) , CSharpUtilities.EnumAsString(actionType), CSharpUtilities.EnumAsString(existsOption) , functionBuilder.ContextParamName)); if (actionType != FileOperationsShared.ActionType.Delete) { functionBuilder.AddCode("return destinationFilePath;"); } } functionBuilder.AddAssemblyReference(typeof(FileOperations)); }
public override void GenerateCode(IFunctionBuilder functionBuilder) { bool isText = FunctionData.Properties[FileOpenShared.IsTextPropertyName].GetValue <bool>(); functionBuilder.AddCode(string.Format( @"var fileOpenX = new Twenty57.Linx.Components.File.FileOpen.FileOpenX({0}, {1}, {2}, {3}, {4}, message => {5}.Log(message)); {6} = fileOpenX.Select(fileHandle => new Twenty57.Linx.Plugin.Common.CodeGeneration.NextResult({7}, new {8} {{ {9} = fileOpenX.FilePath, {10} = ({11})fileHandle }})); return fileOpenX.FilePath;" , functionBuilder.GetParamName(FileOpenShared.FilePathPropertyName), CSharpUtilities.BoolAsString(isText), CSharpUtilities.EnumAsString(FunctionData.Properties[FileOpenShared.CodepagePropertyName].Value), CSharpUtilities.EnumAsString(FunctionData.Properties[FileOpenShared.FileDoesNotExistPropertyName].Value), CSharpUtilities.EnumAsString(FunctionData.Properties[FileOpenShared.FileExistsPropertyName].Value), functionBuilder.ContextParamName, functionBuilder.ExecutionPathOutParamName, CSharpUtilities.ToVerbatimString(FileOpenShared.ExecutionPathName), functionBuilder.GetTypeName(FunctionData.ExecutionPaths[FileOpenShared.ExecutionPathName].Output), FileOpenShared.OutputFilePathPropertyName, FileOpenShared.OutputFileHandlePropertyName, (isText ? typeof(TextFileHandle) : typeof(BinaryFileHandle)).FullName)); functionBuilder.AddAssemblyReference(typeof(FileOpenX)); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("\r\n"); this.Write("\r\n"); this.Write("\r\n"); this.Write("\r\n"); #line 22 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" string lengthList = ""; foreach (var field in fields.FieldList) { lengthList += field.Length + ","; } lengthList = lengthList.Substring(0, lengthList.Length - 1); #line default #line hidden this.Write("\r\nvar fieldParser = new Twenty57.Linx.Components.File.TextFileRead.FieldParser(\r\n" + "\t\t"); #line 29 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(fields.TextFileType))); #line default #line hidden this.Write(",\r\n\t\t"); #line 30 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(fields.Delimiter))); #line default #line hidden this.Write(",\r\n\t\t"); #line 31 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(fields.TextQualifier))); #line default #line hidden this.Write(",\r\n\t\t"); #line 32 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ToVerbatimString(fields.OtherDelimiter))); #line default #line hidden this.Write(",\r\n\t\t"); #line 33 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ToVerbatimString(lengthList))); #line default #line hidden this.Write(");\r\nFunc<Twenty57.Linx.Components.File.TextFileRead.TextFileReader.NextString,"); #line 34 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(pathOutputTypeName)); #line default #line hidden this.Write("> parseField = (nextLine)=> \r\n{\r\n\tif(nextLine != null)\r\n\t{\r\n\t\tvar parsedFields = " + "fieldParser.GetValues(nextLine.LineContents);\r\n\t\tvar record = new "); #line 39 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(pathOutputTypeName)); #line default #line hidden this.Write("();\r\n\t\tvar recordInner = new "); #line 40 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(recordInnerTypeName)); #line default #line hidden this.Write("();\r\n\t\trecord."); #line 41 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(outputLineNumberName)); #line default #line hidden this.Write(" = nextLine.LineNumber;\r\n\t\t"); #line 42 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" int index = 0; foreach (var field in fields.FieldList) { if (!field.Skip) { #line default #line hidden this.Write("\t\t\t\tif("); #line 48 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(index)); #line default #line hidden this.Write(" < parsedFields.Length)\r\n\t\t\t\t{\r\n\t\t\t\t\t"); #line 50 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" if (field.Type.Is(typeof(DateTime)) && !String.IsNullOrWhiteSpace(field.Format)) { #line default #line hidden this.Write("\t\t\t\t\trecordInner."); #line 51 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(field.Name)); #line default #line hidden this.Write(" = DateTime.ParseExact(parsedFields["); #line 51 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(index)); #line default #line hidden this.Write("], \""); #line 51 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(field.Format)); #line default #line hidden this.Write("\", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTi" + "meStyles.None);\r\n\t\t\t\t\t"); #line 52 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" } else if (field.Type.Is(typeof(decimal)) || (field.Type.Is(typeof(double)))) { #line default #line hidden this.Write("\t\t\t\t\trecordInner."); #line 53 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(field.Name)); #line default #line hidden this.Write(" = "); #line 53 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(field.Type.GetGeneratedType())); #line default #line hidden this.Write(".Parse(parsedFields["); #line 53 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(index)); #line default #line hidden this.Write("], System.Globalization.CultureInfo.InvariantCulture);\r\n\t\t\t\t\t"); #line 54 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" } else { #line default #line hidden this.Write(" \r\n\t\t\t\t\trecordInner."); #line 55 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(field.Name)); #line default #line hidden this.Write(" = ("); #line 55 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(field.Type.GetGeneratedType())); #line default #line hidden this.Write(")Convert.ChangeType(parsedFields["); #line 55 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(index)); #line default #line hidden this.Write("], typeof("); #line 55 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(field.Type.GetGeneratedType())); #line default #line hidden this.Write("));\r\n\t\t\t\t\t"); #line 56 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" } #line default #line hidden this.Write("\t\t\t\t}\r\n\t\t"); #line 58 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" } index++; } #line default #line hidden this.Write("\t\trecord."); #line 61 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(recordInnerMemberName)); #line default #line hidden this.Write(" = recordInner;\r\n\t\treturn record;\r\n\t}\r\n\telse\r\n\t{\r\n\t\treturn null;\r\n\t}\r\n};\r\n\r\nvar f" + "ileHandle = (Twenty57.Linx.Components.File.Common.TextFileHandle)"); #line 70 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(filePathPropertyName)); #line default #line hidden this.Write(";\r\nfileHandle.LogEvent += message => "); #line 71 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionContextPropertyName)); #line default #line hidden this.Write(".Log(message);\r\nvar reader = new Twenty57.Linx.Components.File.TextFileRead.TextF" + "ileReader(\r\n\tfileHandle, \r\n\t"); #line 74 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(readType))); #line default #line hidden this.Write(", \r\n\t"); #line 75 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(codePage))); #line default #line hidden this.Write(", \r\n\t"); #line 76 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(skipHeaderLines)); #line default #line hidden this.Write(",\r\n\t"); #line 77 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(skipFooterLines)); #line default #line hidden this.Write("\r\n\t);\r\nreader.LogEvent += message => "); #line 79 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionContextPropertyName)); #line default #line hidden this.Write(".Log(message);\r\n"); #line 80 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(executionPathOutputName)); #line default #line hidden this.Write(" = reader.Lines().Select(v=> new Twenty57.Linx.Plugin.Common.CodeGeneration.NextR" + "esult(\""); #line 80 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadFieldsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(resultsExecutionPathName)); #line default #line hidden this.Write("\", parseField(v)));\r\n"); return(this.GenerationEnvironment.ToString()); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("\r\n"); this.Write("\r\nvar OutputNames = "); #line 23 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ArrayAsString(ResultTypeFields.Select(x => x.Name)))); #line default #line hidden this.Write(";\r\nvar ColumnNames = "); #line 24 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ArrayAsString(ResultTypeFields.Select(x => x.ColumnName)))); #line default #line hidden this.Write(";\r\nvar SqlIdentifiers = "); #line 25 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(SqlIdentifiers)); #line default #line hidden this.Write(";\r\nvar SqlValues = "); #line 26 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(SqlValues)); #line default #line hidden this.Write(";\r\n\r\nvar executeSqlX = new Twenty57.Linx.Components.Database.ExecuteSQL.ExecuteSQ" + "LX(\r\n"); #line 29 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" if (UseTransaction) { #line default #line hidden #line 30 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TransactionProperty)); #line default #line hidden this.Write(".GetConnectionType(), "); #line 30 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TransactionProperty)); #line default #line hidden this.Write(".GetDbTransaction(), \r\n"); #line 31 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } else { #line default #line hidden #line 32 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(ConnectionType))); #line default #line hidden this.Write(", "); #line 32 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ConnectionStringProperty)); #line default #line hidden this.Write(", \r\n"); #line 33 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } #line default #line hidden #line 34 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Timeout)); #line default #line hidden this.Write(", OutputNames, ColumnNames, "); #line 34 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Sql)); #line default #line hidden this.Write(", SqlIdentifiers, SqlValues);\r\nexecuteSqlX.LogEvent += message => "); #line 35 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(FunctionContextProperty)); #line default #line hidden this.Write(".Log(message);\r\n\r\n"); #line 37 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" if (RowType != null) { #line default #line hidden this.Write("\r\nvar rowBuilder = new System.Func<"); #line 39 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(RowTypeName)); #line default #line hidden this.Write(">(() => {\r\n\t"); #line 40 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" var rowFields = ResultTypeFields.Where(f => !string.IsNullOrEmpty(f.Name)); var logFormatString = "Retrieved "; int index = 0; foreach (var nextField in rowFields) { logFormatString += string.Format("{0} = {{{1}}}, ", nextField.ColumnName, index++); } #line default #line hidden this.Write("\t"); #line 46 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(FunctionContextProperty)); #line default #line hidden this.Write(".Log(System.String.Format("); #line 46 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ToVerbatimString(logFormatString.TrimEnd(',', ' ')))); #line default #line hidden this.Write("\r\n\t"); #line 47 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" foreach (var nextField in rowFields) { #line default #line hidden this.Write("\t\t, Twenty57.Linx.Components.Database.Common.LogHelpers.GetDisplayString(executeS" + "qlX.Reader["); #line 48 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ToVerbatimString(nextField.ColumnName))); #line default #line hidden this.Write("])\r\n\t"); #line 49 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } #line default #line hidden this.Write("\t));\r\n\r\n\treturn new "); #line 52 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(RowTypeName)); #line default #line hidden this.Write("\r\n\t{\r\n\t\t"); #line 54 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" foreach (var nextField in rowFields) { #line default #line hidden this.Write("\t\t\t"); #line 55 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(GetParamName(nextField.Name))); #line default #line hidden this.Write(" = Twenty57.Linx.Components.Database.ExecuteSQL.DatabaseHelpers.CheckDbValue<"); #line 55 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Twenty57.Linx.Components.Database.Common.TypeHelpers.GetCodeStringForType(nextField.TypeReference))); #line default #line hidden this.Write(">(executeSqlX.Reader["); #line 55 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ToVerbatimString(nextField.ColumnName))); #line default #line hidden this.Write("]), \r\n\t\t"); #line 56 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } #line default #line hidden this.Write("\t};\r\n});\r\n\r\n"); #line 60 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" if (ReturnMode == ExecuteSQLShared.ReturnModeType.ListOfRows) { #line default #line hidden this.Write("try\r\n{\r\n\texecuteSqlX.OpenReader();\r\n\r\n\tvar table = new List<"); #line 65 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(RowTypeName)); #line default #line hidden this.Write(">();\r\n\twhile (executeSqlX.Reader.Read())\r\n\t\ttable.Add(rowBuilder());\r\n\treturn tab" + "le;\r\n}\r\nfinally\r\n{\r\n\texecuteSqlX.Dispose();\r\n}\r\n"); #line 74 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } else if ((ReturnMode == ExecuteSQLShared.ReturnModeType.FirstRow) || (ReturnMode == ExecuteSQLShared.ReturnModeType.FirstRowElseEmptyRow)) { #line default #line hidden this.Write("try\r\n{\r\n\texecuteSqlX.OpenReader();\r\n\r\n\t"); #line 79 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(RowTypeName)); #line default #line hidden this.Write(" row;\r\n\tif (executeSqlX.Reader.Read())\r\n\t\trow = rowBuilder();\r\n\telse\r\n\t{\r\n\t\t"); #line 84 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" if (ReturnMode == ExecuteSQLShared.ReturnModeType.FirstRow) { #line default #line hidden this.Write("\t\tthrow new Exception(\"No rows returned by query.\");\r\n\t\t"); #line 86 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } else { #line default #line hidden this.Write("\t\trow = new "); #line 87 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(RowTypeName)); #line default #line hidden this.Write("();\r\n\t\t"); #line 88 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } #line default #line hidden this.Write("\t}\r\n\r\n\treturn row;\r\n}\r\nfinally\r\n{\r\n\texecuteSqlX.Dispose();\r\n}\r\n"); #line 97 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } else { #line default #line hidden this.Write("executeSqlX.OpenReader();\r\n"); #line 99 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ExecutionPathOutputName)); #line default #line hidden this.Write(" = \r\nexecuteSqlX.Rows<Twenty57.Linx.Plugin.Common.CodeGeneration.NextResult>(read" + "er => {\r\n\tvar row = rowBuilder();\r\n\treturn new Twenty57.Linx.Plugin.Common.CodeG" + "eneration.NextResult(\""); #line 102 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ExecutionPathName)); #line default #line hidden this.Write("\", row);\r\n});\r\n"); #line 104 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } #line default #line hidden #line 105 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } else { #line default #line hidden this.Write("try\r\n{\r\n\texecuteSqlX.OpenReader();\r\n}\r\nfinally\r\n{\r\n\texecuteSqlX.Dispose();\r\n}\r\n"); #line 114 "D:\Hg\Linx5 Components\Database\Code\Database\ExecuteSQL\ExecuteSQL_Gen.tt" } #line default #line hidden return(this.GenerationEnvironment.ToString()); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("\r\n"); this.Write("\r\n"); this.Write("\r\n"); this.Write("\r\n"); this.Write("\r\nvar fileHandle = (Twenty57.Linx.Components.File.Common.TextFileHandle)"); #line 21 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(filePathPropertyName)); #line default #line hidden this.Write(";\r\nfileHandle.LogEvent += message => "); #line 22 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionContextPropertyName)); #line default #line hidden this.Write(".Log(message);\r\nvar reader = new Twenty57.Linx.Components.File.TextFileRead.TextF" + "ileReader(\r\n\tfileHandle, \r\n\t"); #line 25 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(readType))); #line default #line hidden this.Write(", \r\n\t"); #line 26 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(codePage))); #line default #line hidden this.Write(", \r\n\t"); #line 27 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(skipHeaderLines)); #line default #line hidden this.Write(",\r\n\t"); #line 28 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(skipFooterLines)); #line default #line hidden this.Write(");\r\nreader.LogEvent += message => "); #line 29 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionContextPropertyName)); #line default #line hidden this.Write(".Log(message);\r\n\r\n"); #line 31 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(executionPathOutputName)); #line default #line hidden this.Write(" = reader.Lines().Select(v=>\r\n\t\t\tnew Twenty57.Linx.Plugin.Common.CodeGeneration.N" + "extResult(\r\n\t\t\t\t\""); #line 33 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(resultsExecutionPathName)); #line default #line hidden this.Write("\",\r\n\t\t\t\tnew "); #line 34 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(pathOutputTypeName)); #line default #line hidden this.Write("\r\n\t\t\t\t{ \r\n\t\t\t\t\t"); #line 36 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(outputLineNumberName)); #line default #line hidden this.Write(" = v.LineNumber,\r\n\t\t\t\t\t"); #line 37 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStringsAndLoop_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(outputLineContentsName)); #line default #line hidden this.Write(" = v.LineContents\r\n\t\t\t\t}\r\n\t\t\t)\r\n);\r\n"); return(this.GenerationEnvironment.ToString()); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("\r\n"); this.Write("\r\n"); this.Write("\r\n\r\nvar bulkCopier = new Twenty57.Linx.Components.Database.DbBulkCopy.Runtime.DbB" + "ulkCopierX(\r\n\t"); #line 19 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(ConnectionType))); #line default #line hidden this.Write(", "); #line 19 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ConnectionStringProperty)); #line default #line hidden this.Write(", "); #line 19 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ToVerbatimString(TableName))); #line default #line hidden this.Write("\r\n"); #line 20 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" foreach (var nextColumnName in ColumnNames) { #line default #line hidden this.Write(", "); #line 21 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ToVerbatimString(nextColumnName))); #line default #line hidden this.Write("\r\n"); #line 22 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" } #line default #line hidden this.Write(");\r\nbulkCopier.Timeout = "); #line 23 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Timeout)); #line default #line hidden this.Write(";\r\nbulkCopier.BatchSize = "); #line 24 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(BatchSize)); #line default #line hidden this.Write(";\r\nbulkCopier.LogEvent += message => "); #line 25 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(FunctionContextProperty)); #line default #line hidden this.Write(".Log(message);\r\n\r\nvar makeRow = new System.Func<dynamic, object[]>(row => {\r\n\tobj" + "ect[] columns = new object["); #line 28 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ColumnPropertyNames.Length)); #line default #line hidden this.Write("];\r\n\t"); #line 29 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" for (int i = 0; i < ColumnPropertyNames.Length; i++) { #line default #line hidden this.Write("\tcolumns["); #line 30 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(i)); #line default #line hidden this.Write("] = \r\n\t\t"); #line 31 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" if (ColumnDataTypes[i] == Twenty57.Linx.Components.Database.Common.DatabaseModel.DataType.Binary) { #line default #line hidden this.Write("\t\trow."); #line 32 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ColumnPropertyNames[i])); #line default #line hidden this.Write(" == null ? null : row."); #line 32 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ColumnPropertyNames[i])); #line default #line hidden this.Write(".ToArray();\r\n\t\t"); #line 33 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" } else { #line default #line hidden this.Write("\t\trow."); #line 34 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ColumnPropertyNames[i])); #line default #line hidden this.Write(";\r\n\t\t"); #line 35 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" } #line default #line hidden this.Write("\t"); #line 36 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" } #line default #line hidden this.Write("\treturn columns;\r\n});\r\n\r\nbulkCopier.Start();\r\n"); #line 41 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(ExecutionPathOutputName)); #line default #line hidden this.Write(" = Twenty57.Linx.Components.Database.DbBulkCopy.Runtime.SingleEnumerable.Make(\r\n\t" + "new Twenty57.Linx.Components.Database.DbBulkCopy.Runtime.Loader(bulkCopier, make" + "Row))\r\n\t.Select(l => new Twenty57.Linx.Plugin.Common.CodeGeneration.NextResult("); #line 43 "D:\Hg\Linx5 Components\Database\Code\Database\DbBulkCopy\DbBulkCopy_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.ToVerbatimString(ExecutionPathName))); #line default #line hidden this.Write(", l));\r\n"); return(this.GenerationEnvironment.ToString()); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("\r\n"); this.Write("\r\n"); this.Write("\r\nvar fileHandle = (Twenty57.Linx.Components.File.Common.TextFileHandle)"); #line 13 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStrings_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(filePathPropertyName)); #line default #line hidden this.Write(";\r\nfileHandle.LogEvent += message => "); #line 14 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStrings_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionContextPropertyName)); #line default #line hidden this.Write(".Log(message);\r\nvar reader = new Twenty57.Linx.Components.File.TextFileRead.TextF" + "ileReader(\r\n\tfileHandle, \r\n\t"); #line 17 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStrings_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(readType))); #line default #line hidden this.Write(", \r\n\t"); #line 18 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStrings_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CSharpUtilities.EnumAsString(codePage))); #line default #line hidden this.Write(", \r\n\t"); #line 19 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStrings_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(skipHeaderLines)); #line default #line hidden this.Write(",\r\n\t"); #line 20 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStrings_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(skipFooterLines)); #line default #line hidden this.Write(");\r\nreader.LogEvent += message => "); #line 21 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStrings_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(functionContextPropertyName)); #line default #line hidden this.Write(".Log(message);\r\n\r\n"); #line 23 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStrings_Gen.tt" var readMethod = readType == Twenty57.Linx.Components.File.TextFileRead.FileReadOptions.Complete ? "ReadComplete" : "ReadTableNoFields"; #line default #line hidden this.Write("\r\nreturn reader."); #line 27 "C:\Projects\Linx\linx5-components\linx5-components-file\Code\File\TextFileRead\Templates\TextFileReadStrings_Gen.tt" this.Write(this.ToStringHelper.ToStringWithCulture(readMethod)); #line default #line hidden this.Write("();\r\n"); return(this.GenerationEnvironment.ToString()); }