WebController.cs 14 KB

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