ServiceInterface.cs 14 KB

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