ServiceInterface.cs 16 KB

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