ListDto.cs 16 KB

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