ListDto.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. // ------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // 此代码由工具生成。
  4. // 运行时版本: 17.0.0.0
  5. //
  6. // 对此文件的更改可能导致不正确的行为,如果
  7. // 重新生成代码,这些更改将会丢失。
  8. // </auto-generated>
  9. // ------------------------------------------------------------------------------
  10. namespace VberAdmin.Templates.V4
  11. {
  12. using System.Linq;
  13. using System.Text;
  14. using System.Collections.Generic;
  15. using System;
  16. /// <summary>
  17. /// Class to produce the template output
  18. /// </summary>
  19. #line 1 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  20. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
  21. public partial class ListDto : ListDtoBase
  22. {
  23. #line hidden
  24. /// <summary>
  25. /// Create the template output
  26. /// </summary>
  27. public virtual string TransformText()
  28. {
  29. this.Write("using Abp.AutoMapper;\r\n\r\nusing VberZero.AppService.Base.Dto;\r\n\r\nnamespace ");
  30. #line 10 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  31. this.Write(this.ToStringHelper.ToStringWithCulture(Model.ApplicationNamespace));
  32. #line default
  33. #line hidden
  34. this.Write(".Dto\r\n{\r\n");
  35. #line 12 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  36. if(!string.IsNullOrEmpty(Model.HtmlPageTitle)){
  37. #line default
  38. #line hidden
  39. this.Write(" \r\n /// <summary>\r\n /// ");
  40. #line 16 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  41. this.Write(this.ToStringHelper.ToStringWithCulture(Model.HtmlPageTitle));
  42. #line default
  43. #line hidden
  44. this.Write("\r\n /// </summary> \r\n");
  45. #line 18 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  46. }
  47. #line default
  48. #line hidden
  49. this.Write(" [AutoMapTo(typeof(");
  50. #line 19 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  51. this.Write(this.ToStringHelper.ToStringWithCulture(Model.ClassName));
  52. #line default
  53. #line hidden
  54. this.Write(")),AutoMapFrom(typeof(");
  55. #line 19 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  56. this.Write(this.ToStringHelper.ToStringWithCulture(Model.ClassName));
  57. #line default
  58. #line hidden
  59. this.Write("))]\r\n public class ");
  60. #line 20 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  61. this.Write(this.ToStringHelper.ToStringWithCulture(Model.FileName));
  62. #line default
  63. #line hidden
  64. this.Write("Dto: VzEntityDto<");
  65. #line 20 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  66. this.Write(this.ToStringHelper.ToStringWithCulture(Model.IdType));
  67. #line default
  68. #line hidden
  69. this.Write(">\r\n {\r\n");
  70. #line 22 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  71. foreach (var item in Model.Columns)
  72. {
  73. if(!item.IsGenreated) continue;
  74. if(!string.IsNullOrEmpty(item.Comment)){
  75. #line default
  76. #line hidden
  77. this.Write(" /// <summary>\r\n /// ");
  78. #line 28 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  79. this.Write(this.ToStringHelper.ToStringWithCulture(item.Comment));
  80. #line default
  81. #line hidden
  82. this.Write("\r\n /// </summary> \r\n");
  83. #line 30 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  84. }
  85. #line default
  86. #line hidden
  87. this.Write(" public ");
  88. #line 31 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  89. this.Write(this.ToStringHelper.ToStringWithCulture(item.AttrType));
  90. #line default
  91. #line hidden
  92. this.Write(" ");
  93. #line 31 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  94. this.Write(this.ToStringHelper.ToStringWithCulture(item.ColumnName));
  95. #line default
  96. #line hidden
  97. this.Write(" { get; set; }\r\n");
  98. #line 32 "D:\02Study\ABP\VberAdminBaseSystem\Template\VberAdminTemplate\CodeGenerator\Templates\V4\ListDto.tt"
  99. }
  100. #line default
  101. #line hidden
  102. this.Write(" }\r\n}");
  103. return this.GenerationEnvironment.ToString();
  104. }
  105. }
  106. #line default
  107. #line hidden
  108. #region Base class
  109. /// <summary>
  110. /// Base class for this transformation
  111. /// </summary>
  112. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
  113. public class ListDtoBase
  114. {
  115. #region Fields
  116. private global::System.Text.StringBuilder generationEnvironmentField;
  117. private global::System.CodeDom.Compiler.CompilerErrorCollection errorsField;
  118. private global::System.Collections.Generic.List<int> indentLengthsField;
  119. private string currentIndentField = "";
  120. private bool endsWithNewline;
  121. private global::System.Collections.Generic.IDictionary<string, object> sessionField;
  122. #endregion
  123. #region Properties
  124. /// <summary>
  125. /// The string builder that generation-time code is using to assemble generated output
  126. /// </summary>
  127. protected System.Text.StringBuilder GenerationEnvironment
  128. {
  129. get
  130. {
  131. if ((this.generationEnvironmentField == null))
  132. {
  133. this.generationEnvironmentField = new global::System.Text.StringBuilder();
  134. }
  135. return this.generationEnvironmentField;
  136. }
  137. set
  138. {
  139. this.generationEnvironmentField = value;
  140. }
  141. }
  142. /// <summary>
  143. /// The error collection for the generation process
  144. /// </summary>
  145. public System.CodeDom.Compiler.CompilerErrorCollection Errors
  146. {
  147. get
  148. {
  149. if ((this.errorsField == null))
  150. {
  151. this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection();
  152. }
  153. return this.errorsField;
  154. }
  155. }
  156. /// <summary>
  157. /// A list of the lengths of each indent that was added with PushIndent
  158. /// </summary>
  159. private System.Collections.Generic.List<int> indentLengths
  160. {
  161. get
  162. {
  163. if ((this.indentLengthsField == null))
  164. {
  165. this.indentLengthsField = new global::System.Collections.Generic.List<int>();
  166. }
  167. return this.indentLengthsField;
  168. }
  169. }
  170. /// <summary>
  171. /// Gets the current indent we use when adding lines to the output
  172. /// </summary>
  173. public string CurrentIndent
  174. {
  175. get
  176. {
  177. return this.currentIndentField;
  178. }
  179. }
  180. /// <summary>
  181. /// Current transformation session
  182. /// </summary>
  183. public virtual global::System.Collections.Generic.IDictionary<string, object> Session
  184. {
  185. get
  186. {
  187. return this.sessionField;
  188. }
  189. set
  190. {
  191. this.sessionField = value;
  192. }
  193. }
  194. #endregion
  195. #region Transform-time helpers
  196. /// <summary>
  197. /// Write text directly into the generated output
  198. /// </summary>
  199. public void Write(string textToAppend)
  200. {
  201. if (string.IsNullOrEmpty(textToAppend))
  202. {
  203. return;
  204. }
  205. // If we're starting off, or if the previous text ended with a newline,
  206. // we have to append the current indent first.
  207. if (((this.GenerationEnvironment.Length == 0)
  208. || this.endsWithNewline))
  209. {
  210. this.GenerationEnvironment.Append(this.currentIndentField);
  211. this.endsWithNewline = false;
  212. }
  213. // Check if the current text ends with a newline
  214. if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture))
  215. {
  216. this.endsWithNewline = true;
  217. }
  218. // This is an optimization. If the current indent is "", then we don't have to do any
  219. // of the more complex stuff further down.
  220. if ((this.currentIndentField.Length == 0))
  221. {
  222. this.GenerationEnvironment.Append(textToAppend);
  223. return;
  224. }
  225. // Everywhere there is a newline in the text, add an indent after it
  226. textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField));
  227. // If the text ends with a newline, then we should strip off the indent added at the very end
  228. // because the appropriate indent will be added when the next time Write() is called
  229. if (this.endsWithNewline)
  230. {
  231. this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length));
  232. }
  233. else
  234. {
  235. this.GenerationEnvironment.Append(textToAppend);
  236. }
  237. }
  238. /// <summary>
  239. /// Write text directly into the generated output
  240. /// </summary>
  241. public void WriteLine(string textToAppend)
  242. {
  243. this.Write(textToAppend);
  244. this.GenerationEnvironment.AppendLine();
  245. this.endsWithNewline = true;
  246. }
  247. /// <summary>
  248. /// Write formatted text directly into the generated output
  249. /// </summary>
  250. public void Write(string format, params object[] args)
  251. {
  252. this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
  253. }
  254. /// <summary>
  255. /// Write formatted text directly into the generated output
  256. /// </summary>
  257. public void WriteLine(string format, params object[] args)
  258. {
  259. this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args));
  260. }
  261. /// <summary>
  262. /// Raise an error
  263. /// </summary>
  264. public void Error(string message)
  265. {
  266. System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError();
  267. error.ErrorText = message;
  268. this.Errors.Add(error);
  269. }
  270. /// <summary>
  271. /// Raise a warning
  272. /// </summary>
  273. public void Warning(string message)
  274. {
  275. System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError();
  276. error.ErrorText = message;
  277. error.IsWarning = true;
  278. this.Errors.Add(error);
  279. }
  280. /// <summary>
  281. /// Increase the indent
  282. /// </summary>
  283. public void PushIndent(string indent)
  284. {
  285. if ((indent == null))
  286. {
  287. throw new global::System.ArgumentNullException("indent");
  288. }
  289. this.currentIndentField = (this.currentIndentField + indent);
  290. this.indentLengths.Add(indent.Length);
  291. }
  292. /// <summary>
  293. /// Remove the last indent that was added with PushIndent
  294. /// </summary>
  295. public string PopIndent()
  296. {
  297. string returnValue = "";
  298. if ((this.indentLengths.Count > 0))
  299. {
  300. int indentLength = this.indentLengths[(this.indentLengths.Count - 1)];
  301. this.indentLengths.RemoveAt((this.indentLengths.Count - 1));
  302. if ((indentLength > 0))
  303. {
  304. returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength));
  305. this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
  306. }
  307. }
  308. return returnValue;
  309. }
  310. /// <summary>
  311. /// Remove any indentation
  312. /// </summary>
  313. public void ClearIndent()
  314. {
  315. this.indentLengths.Clear();
  316. this.currentIndentField = "";
  317. }
  318. #endregion
  319. #region ToString Helpers
  320. /// <summary>
  321. /// Utility class to produce culture-oriented representation of an object as a string.
  322. /// </summary>
  323. public class ToStringInstanceHelper
  324. {
  325. private System.IFormatProvider formatProviderField = global::System.Globalization.CultureInfo.InvariantCulture;
  326. /// <summary>
  327. /// Gets or sets format provider to be used by ToStringWithCulture method.
  328. /// </summary>
  329. public System.IFormatProvider FormatProvider
  330. {
  331. get
  332. {
  333. return this.formatProviderField ;
  334. }
  335. set
  336. {
  337. if ((value != null))
  338. {
  339. this.formatProviderField = value;
  340. }
  341. }
  342. }
  343. /// <summary>
  344. /// This is called from the compile/run appdomain to convert objects within an expression block to a string
  345. /// </summary>
  346. public string ToStringWithCulture(object objectToConvert)
  347. {
  348. if ((objectToConvert == null))
  349. {
  350. throw new global::System.ArgumentNullException("objectToConvert");
  351. }
  352. System.Type t = objectToConvert.GetType();
  353. System.Reflection.MethodInfo method = t.GetMethod("ToString", new System.Type[] {
  354. typeof(System.IFormatProvider)});
  355. if ((method == null))
  356. {
  357. return objectToConvert.ToString();
  358. }
  359. else
  360. {
  361. return ((string)(method.Invoke(objectToConvert, new object[] {
  362. this.formatProviderField })));
  363. }
  364. }
  365. }
  366. private ToStringInstanceHelper toStringHelperField = new ToStringInstanceHelper();
  367. /// <summary>
  368. /// Helper to produce culture-oriented representation of an object as a string
  369. /// </summary>
  370. public ToStringInstanceHelper ToStringHelper
  371. {
  372. get
  373. {
  374. return this.toStringHelperField;
  375. }
  376. }
  377. #endregion
  378. }
  379. #endregion
  380. }