OperateResult.cs 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace MECF.Framework.RT.Core.IoProviders.Common
  6. {
  7. /*******************************************************************************
  8. *
  9. * 用户返回多个结果数据的一个类,允许返回操作结果,文本信息,错误代号,等等
  10. *
  11. * Used to the return result class in the synchronize communication and communication for industrial Ethernet
  12. *
  13. * 时间:2017年11月20日 11:43:57
  14. * 更新:废除原先的2个结果派生类,新增10个泛型派生类,来满足绝大多数的场景使用
  15. *
  16. * 时间:2018年3月11日 22:08:08
  17. * 更新:新增一些静态方法来方便的获取带有参数的成功对象,新增快速复制错误信息的方法
  18. *
  19. * 时间:2018年8月23日 12:19:36
  20. * 更新:新增两个不同的结果对象构造方法
  21. *
  22. *******************************************************************************/
  23. /// <summary>
  24. /// 操作结果的类,只带有成功标志和错误信息 -> The class that operates the result, with only success flags and error messages
  25. /// </summary>
  26. /// <remarks>
  27. /// 当 <see cref="IsSuccess"/> 为 True 时,忽略 <see cref="Message"/> 及 <see cref="ErrorCode"/> 的值
  28. /// </remarks>
  29. public class OperateResult
  30. {
  31. #region Constructor
  32. /// <summary>
  33. /// 实例化一个默认的结果对象
  34. /// </summary>
  35. public OperateResult()
  36. {
  37. }
  38. /// <summary>
  39. /// 使用指定的消息实例化一个默认的结果对象
  40. /// </summary>
  41. /// <param name="msg">错误消息</param>
  42. public OperateResult( string msg )
  43. {
  44. this.Message = msg;
  45. }
  46. /// <summary>
  47. /// 使用错误代码,消息文本来实例化对象
  48. /// </summary>
  49. /// <param name="err">错误代码</param>
  50. /// <param name="msg">错误消息</param>
  51. public OperateResult( int err, string msg )
  52. {
  53. this.ErrorCode = err;
  54. this.Message = msg;
  55. }
  56. #endregion
  57. /// <summary>
  58. /// 指示本次访问是否成功
  59. /// </summary>
  60. public bool IsSuccess { get; set; }
  61. /// <summary>
  62. /// 具体的错误描述
  63. /// </summary>
  64. public string Message { get; set; } = StringResources.Language.UnknownError;
  65. /// <summary>
  66. /// 具体的错误代码
  67. /// </summary>
  68. public int ErrorCode { get; set; } = 10000;
  69. /// <summary>
  70. /// 获取错误代号及文本描述
  71. /// </summary>
  72. /// <returns>包含错误码及错误消息</returns>
  73. public string ToMessageShowString()
  74. {
  75. return $"{StringResources.Language.ErrorCode}:{ErrorCode}{Environment.NewLine}{StringResources.Language.TextDescription}:{Message}";
  76. }
  77. /// <summary>
  78. /// 从另一个结果类中拷贝错误信息
  79. /// </summary>
  80. /// <typeparam name="TResult">支持结果类及派生类</typeparam>
  81. /// <param name="result">结果类及派生类的对象</param>
  82. public void CopyErrorFromOther<TResult>(TResult result) where TResult : OperateResult
  83. {
  84. if (result != null)
  85. {
  86. ErrorCode = result.ErrorCode;
  87. Message = result.Message;
  88. }
  89. }
  90. #region Static Method
  91. /*****************************************************************************************************
  92. *
  93. * 主要是方便获取到一些特殊状态的结果对象
  94. *
  95. ******************************************************************************************************/
  96. /// <summary>
  97. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  98. /// </summary>
  99. /// <typeparam name="T">目标数据类型</typeparam>
  100. /// <param name="result">之前的结果对象</param>
  101. /// <returns>带默认泛型对象的失败结果类</returns>
  102. public static OperateResult<T> CreateFailedResult<T>( OperateResult result )
  103. {
  104. return new OperateResult<T>( )
  105. {
  106. ErrorCode = result.ErrorCode,
  107. Message = result.Message,
  108. };
  109. }
  110. /// <summary>
  111. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  112. /// </summary>
  113. /// <typeparam name="T1">目标数据类型一</typeparam>
  114. /// <typeparam name="T2">目标数据类型二</typeparam>
  115. /// <param name="result">之前的结果对象</param>
  116. /// <returns>带默认泛型对象的失败结果类</returns>
  117. public static OperateResult<T1, T2> CreateFailedResult<T1, T2>( OperateResult result )
  118. {
  119. return new OperateResult<T1, T2>( )
  120. {
  121. ErrorCode = result.ErrorCode,
  122. Message = result.Message,
  123. };
  124. }
  125. /// <summary>
  126. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  127. /// </summary>
  128. /// <typeparam name="T1">目标数据类型一</typeparam>
  129. /// <typeparam name="T2">目标数据类型二</typeparam>
  130. /// <typeparam name="T3">目标数据类型三</typeparam>
  131. /// <param name="result">之前的结果对象</param>
  132. /// <returns>带默认泛型对象的失败结果类</returns>
  133. public static OperateResult<T1, T2, T3> CreateFailedResult<T1, T2, T3>( OperateResult result )
  134. {
  135. return new OperateResult<T1, T2, T3>( )
  136. {
  137. ErrorCode = result.ErrorCode,
  138. Message = result.Message,
  139. };
  140. }
  141. /// <summary>
  142. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  143. /// </summary>
  144. /// <typeparam name="T1">目标数据类型一</typeparam>
  145. /// <typeparam name="T2">目标数据类型二</typeparam>
  146. /// <typeparam name="T3">目标数据类型三</typeparam>
  147. /// <typeparam name="T4">目标数据类型四</typeparam>
  148. /// <param name="result">之前的结果对象</param>
  149. /// <returns>带默认泛型对象的失败结果类</returns>
  150. public static OperateResult<T1, T2, T3, T4> CreateFailedResult<T1, T2, T3, T4>( OperateResult result )
  151. {
  152. return new OperateResult<T1, T2, T3, T4>( )
  153. {
  154. ErrorCode = result.ErrorCode,
  155. Message = result.Message,
  156. };
  157. }
  158. /// <summary>
  159. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  160. /// </summary>
  161. /// <typeparam name="T1">目标数据类型一</typeparam>
  162. /// <typeparam name="T2">目标数据类型二</typeparam>
  163. /// <typeparam name="T3">目标数据类型三</typeparam>
  164. /// <typeparam name="T4">目标数据类型四</typeparam>
  165. /// <typeparam name="T5">目标数据类型五</typeparam>
  166. /// <param name="result">之前的结果对象</param>
  167. /// <returns>带默认泛型对象的失败结果类</returns>
  168. public static OperateResult<T1, T2, T3, T4, T5> CreateFailedResult<T1, T2, T3, T4, T5>( OperateResult result )
  169. {
  170. return new OperateResult<T1, T2, T3, T4, T5>( )
  171. {
  172. ErrorCode = result.ErrorCode,
  173. Message = result.Message,
  174. };
  175. }
  176. /// <summary>
  177. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  178. /// </summary>
  179. /// <typeparam name="T1">目标数据类型一</typeparam>
  180. /// <typeparam name="T2">目标数据类型二</typeparam>
  181. /// <typeparam name="T3">目标数据类型三</typeparam>
  182. /// <typeparam name="T4">目标数据类型四</typeparam>
  183. /// <typeparam name="T5">目标数据类型五</typeparam>
  184. /// <typeparam name="T6">目标数据类型六</typeparam>
  185. /// <param name="result">之前的结果对象</param>
  186. /// <returns>带默认泛型对象的失败结果类</returns>
  187. public static OperateResult<T1, T2, T3, T4, T5, T6> CreateFailedResult<T1, T2, T3, T4, T5, T6>( OperateResult result )
  188. {
  189. return new OperateResult<T1, T2, T3, T4, T5, T6>( )
  190. {
  191. ErrorCode = result.ErrorCode,
  192. Message = result.Message,
  193. };
  194. }
  195. /// <summary>
  196. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  197. /// </summary>
  198. /// <typeparam name="T1">目标数据类型一</typeparam>
  199. /// <typeparam name="T2">目标数据类型二</typeparam>
  200. /// <typeparam name="T3">目标数据类型三</typeparam>
  201. /// <typeparam name="T4">目标数据类型四</typeparam>
  202. /// <typeparam name="T5">目标数据类型五</typeparam>
  203. /// <typeparam name="T6">目标数据类型六</typeparam>
  204. /// <typeparam name="T7">目标数据类型七</typeparam>
  205. /// <param name="result">之前的结果对象</param>
  206. /// <returns>带默认泛型对象的失败结果类</returns>
  207. public static OperateResult<T1, T2, T3, T4, T5, T6, T7> CreateFailedResult<T1, T2, T3, T4, T5, T6, T7>( OperateResult result )
  208. {
  209. return new OperateResult<T1, T2, T3, T4, T5, T6, T7>( )
  210. {
  211. ErrorCode = result.ErrorCode,
  212. Message = result.Message,
  213. };
  214. }
  215. /// <summary>
  216. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  217. /// </summary>
  218. /// <typeparam name="T1">目标数据类型一</typeparam>
  219. /// <typeparam name="T2">目标数据类型二</typeparam>
  220. /// <typeparam name="T3">目标数据类型三</typeparam>
  221. /// <typeparam name="T4">目标数据类型四</typeparam>
  222. /// <typeparam name="T5">目标数据类型五</typeparam>
  223. /// <typeparam name="T6">目标数据类型六</typeparam>
  224. /// <typeparam name="T7">目标数据类型七</typeparam>
  225. /// <typeparam name="T8">目标数据类型八</typeparam>
  226. /// <param name="result">之前的结果对象</param>
  227. /// <returns>带默认泛型对象的失败结果类</returns>
  228. public static OperateResult<T1, T2, T3, T4, T5, T6, T7, T8> CreateFailedResult<T1, T2, T3, T4, T5, T6, T7, T8>( OperateResult result )
  229. {
  230. return new OperateResult<T1, T2, T3, T4, T5, T6, T7, T8>( )
  231. {
  232. ErrorCode = result.ErrorCode,
  233. Message = result.Message,
  234. };
  235. }
  236. /// <summary>
  237. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  238. /// </summary>
  239. /// <typeparam name="T1">目标数据类型一</typeparam>
  240. /// <typeparam name="T2">目标数据类型二</typeparam>
  241. /// <typeparam name="T3">目标数据类型三</typeparam>
  242. /// <typeparam name="T4">目标数据类型四</typeparam>
  243. /// <typeparam name="T5">目标数据类型五</typeparam>
  244. /// <typeparam name="T6">目标数据类型六</typeparam>
  245. /// <typeparam name="T7">目标数据类型七</typeparam>
  246. /// <typeparam name="T8">目标数据类型八</typeparam>
  247. /// <typeparam name="T9">目标数据类型九</typeparam>
  248. /// <param name="result">之前的结果对象</param>
  249. /// <returns>带默认泛型对象的失败结果类</returns>
  250. public static OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9> CreateFailedResult<T1, T2, T3, T4, T5, T6, T7, T8, T9>( OperateResult result )
  251. {
  252. return new OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9>( )
  253. {
  254. ErrorCode = result.ErrorCode,
  255. Message = result.Message,
  256. };
  257. }
  258. /// <summary>
  259. /// 创建并返回一个失败的结果对象,该对象复制另一个结果对象的错误信息
  260. /// </summary>
  261. /// <typeparam name="T1">目标数据类型一</typeparam>
  262. /// <typeparam name="T2">目标数据类型二</typeparam>
  263. /// <typeparam name="T3">目标数据类型三</typeparam>
  264. /// <typeparam name="T4">目标数据类型四</typeparam>
  265. /// <typeparam name="T5">目标数据类型五</typeparam>
  266. /// <typeparam name="T6">目标数据类型六</typeparam>
  267. /// <typeparam name="T7">目标数据类型七</typeparam>
  268. /// <typeparam name="T8">目标数据类型八</typeparam>
  269. /// <typeparam name="T9">目标数据类型九</typeparam>
  270. /// <typeparam name="T10">目标数据类型十</typeparam>
  271. /// <param name="result">之前的结果对象</param>
  272. /// <returns>带默认泛型对象的失败结果类</returns>
  273. public static OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> CreateFailedResult<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( OperateResult result )
  274. {
  275. return new OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( )
  276. {
  277. ErrorCode = result.ErrorCode,
  278. Message = result.Message,
  279. };
  280. }
  281. /// <summary>
  282. /// 创建并返回一个成功的结果对象
  283. /// </summary>
  284. /// <returns>成功的结果对象</returns>
  285. public static OperateResult CreateSuccessResult()
  286. {
  287. return new OperateResult()
  288. {
  289. IsSuccess = true,
  290. ErrorCode = 0,
  291. Message = StringResources.Language.SuccessText,
  292. };
  293. }
  294. /// <summary>
  295. /// 创建并返回一个成功的结果对象,并带有一个参数对象
  296. /// </summary>
  297. /// <typeparam name="T">参数类型</typeparam>
  298. /// <param name="value">类型的值对象</param>
  299. /// <returns>成功的结果对象</returns>
  300. public static OperateResult<T> CreateSuccessResult<T>(T value)
  301. {
  302. return new OperateResult<T>()
  303. {
  304. IsSuccess = true,
  305. ErrorCode = 0,
  306. Message = StringResources.Language.SuccessText,
  307. Content = value
  308. };
  309. }
  310. /// <summary>
  311. /// 创建并返回一个成功的结果对象,并带有两个参数对象
  312. /// </summary>
  313. /// <typeparam name="T1">第一个参数类型</typeparam>
  314. /// <typeparam name="T2">第二个参数类型</typeparam>
  315. /// <param name="value1">类型一对象</param>
  316. /// <param name="value2">类型二对象</param>
  317. /// <returns>成的结果对象</returns>
  318. public static OperateResult<T1, T2> CreateSuccessResult<T1, T2>(T1 value1, T2 value2)
  319. {
  320. return new OperateResult<T1, T2>()
  321. {
  322. IsSuccess = true,
  323. ErrorCode = 0,
  324. Message = StringResources.Language.SuccessText,
  325. Content1 = value1,
  326. Content2 = value2,
  327. };
  328. }
  329. /// <summary>
  330. /// 创建并返回一个成功的结果对象,并带有三个参数对象
  331. /// </summary>
  332. /// <typeparam name="T1">第一个参数类型</typeparam>
  333. /// <typeparam name="T2">第二个参数类型</typeparam>
  334. /// <typeparam name="T3">第三个参数类型</typeparam>
  335. /// <param name="value1">类型一对象</param>
  336. /// <param name="value2">类型二对象</param>
  337. /// <param name="value3">类型三对象</param>
  338. /// <returns>成的结果对象</returns>
  339. public static OperateResult<T1, T2, T3> CreateSuccessResult<T1, T2, T3>(T1 value1, T2 value2, T3 value3)
  340. {
  341. return new OperateResult<T1, T2, T3>()
  342. {
  343. IsSuccess = true,
  344. ErrorCode = 0,
  345. Message = StringResources.Language.SuccessText,
  346. Content1 = value1,
  347. Content2 = value2,
  348. Content3 = value3,
  349. };
  350. }
  351. /// <summary>
  352. /// 创建并返回一个成功的结果对象,并带有四个参数对象
  353. /// </summary>
  354. /// <typeparam name="T1">第一个参数类型</typeparam>
  355. /// <typeparam name="T2">第二个参数类型</typeparam>
  356. /// <typeparam name="T3">第三个参数类型</typeparam>
  357. /// <typeparam name="T4">第四个参数类型</typeparam>
  358. /// <param name="value1">类型一对象</param>
  359. /// <param name="value2">类型二对象</param>
  360. /// <param name="value3">类型三对象</param>
  361. /// <param name="value4">类型四对象</param>
  362. /// <returns>成的结果对象</returns>
  363. public static OperateResult<T1, T2, T3, T4> CreateSuccessResult<T1, T2, T3, T4>( T1 value1, T2 value2, T3 value3, T4 value4 )
  364. {
  365. return new OperateResult<T1, T2, T3, T4>( )
  366. {
  367. IsSuccess = true,
  368. ErrorCode = 0,
  369. Message = StringResources.Language.SuccessText,
  370. Content1 = value1,
  371. Content2 = value2,
  372. Content3 = value3,
  373. Content4 = value4,
  374. };
  375. }
  376. /// <summary>
  377. /// 创建并返回一个成功的结果对象,并带有五个参数对象
  378. /// </summary>
  379. /// <typeparam name="T1">第一个参数类型</typeparam>
  380. /// <typeparam name="T2">第二个参数类型</typeparam>
  381. /// <typeparam name="T3">第三个参数类型</typeparam>
  382. /// <typeparam name="T4">第四个参数类型</typeparam>
  383. /// <typeparam name="T5">第五个参数类型</typeparam>
  384. /// <param name="value1">类型一对象</param>
  385. /// <param name="value2">类型二对象</param>
  386. /// <param name="value3">类型三对象</param>
  387. /// <param name="value4">类型四对象</param>
  388. /// <param name="value5">类型五对象</param>
  389. /// <returns>成的结果对象</returns>
  390. public static OperateResult<T1, T2, T3, T4, T5> CreateSuccessResult<T1, T2, T3, T4, T5>( T1 value1, T2 value2, T3 value3, T4 value4, T5 value5 )
  391. {
  392. return new OperateResult<T1, T2, T3, T4, T5>( )
  393. {
  394. IsSuccess = true,
  395. ErrorCode = 0,
  396. Message = StringResources.Language.SuccessText,
  397. Content1 = value1,
  398. Content2 = value2,
  399. Content3 = value3,
  400. Content4 = value4,
  401. Content5 = value5,
  402. };
  403. }
  404. /// <summary>
  405. /// 创建并返回一个成功的结果对象,并带有六个参数对象
  406. /// </summary>
  407. /// <typeparam name="T1">第一个参数类型</typeparam>
  408. /// <typeparam name="T2">第二个参数类型</typeparam>
  409. /// <typeparam name="T3">第三个参数类型</typeparam>
  410. /// <typeparam name="T4">第四个参数类型</typeparam>
  411. /// <typeparam name="T5">第五个参数类型</typeparam>
  412. /// <typeparam name="T6">第六个参数类型</typeparam>
  413. /// <param name="value1">类型一对象</param>
  414. /// <param name="value2">类型二对象</param>
  415. /// <param name="value3">类型三对象</param>
  416. /// <param name="value4">类型四对象</param>
  417. /// <param name="value5">类型五对象</param>
  418. /// <param name="value6">类型六对象</param>
  419. /// <returns>成的结果对象</returns>
  420. public static OperateResult<T1, T2, T3, T4, T5, T6> CreateSuccessResult<T1, T2, T3, T4, T5, T6>( T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6 )
  421. {
  422. return new OperateResult<T1, T2, T3, T4, T5, T6>( )
  423. {
  424. IsSuccess = true,
  425. ErrorCode = 0,
  426. Message = StringResources.Language.SuccessText,
  427. Content1 = value1,
  428. Content2 = value2,
  429. Content3 = value3,
  430. Content4 = value4,
  431. Content5 = value5,
  432. Content6 = value6,
  433. };
  434. }
  435. /// <summary>
  436. /// 创建并返回一个成功的结果对象,并带有七个参数对象
  437. /// </summary>
  438. /// <typeparam name="T1">第一个参数类型</typeparam>
  439. /// <typeparam name="T2">第二个参数类型</typeparam>
  440. /// <typeparam name="T3">第三个参数类型</typeparam>
  441. /// <typeparam name="T4">第四个参数类型</typeparam>
  442. /// <typeparam name="T5">第五个参数类型</typeparam>
  443. /// <typeparam name="T6">第六个参数类型</typeparam>
  444. /// <typeparam name="T7">第七个参数类型</typeparam>
  445. /// <param name="value1">类型一对象</param>
  446. /// <param name="value2">类型二对象</param>
  447. /// <param name="value3">类型三对象</param>
  448. /// <param name="value4">类型四对象</param>
  449. /// <param name="value5">类型五对象</param>
  450. /// <param name="value6">类型六对象</param>
  451. /// <param name="value7">类型七对象</param>
  452. /// <returns>成的结果对象</returns>
  453. public static OperateResult<T1, T2, T3, T4, T5, T6, T7> CreateSuccessResult<T1, T2, T3, T4, T5, T6, T7>( T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7 )
  454. {
  455. return new OperateResult<T1, T2, T3, T4, T5, T6, T7>( )
  456. {
  457. IsSuccess = true,
  458. ErrorCode = 0,
  459. Message = StringResources.Language.SuccessText,
  460. Content1 = value1,
  461. Content2 = value2,
  462. Content3 = value3,
  463. Content4 = value4,
  464. Content5 = value5,
  465. Content6 = value6,
  466. Content7 = value7,
  467. };
  468. }
  469. /// <summary>
  470. /// 创建并返回一个成功的结果对象,并带有八个参数对象
  471. /// </summary>
  472. /// <typeparam name="T1">第一个参数类型</typeparam>
  473. /// <typeparam name="T2">第二个参数类型</typeparam>
  474. /// <typeparam name="T3">第三个参数类型</typeparam>
  475. /// <typeparam name="T4">第四个参数类型</typeparam>
  476. /// <typeparam name="T5">第五个参数类型</typeparam>
  477. /// <typeparam name="T6">第六个参数类型</typeparam>
  478. /// <typeparam name="T7">第七个参数类型</typeparam>
  479. /// <typeparam name="T8">第八个参数类型</typeparam>
  480. /// <param name="value1">类型一对象</param>
  481. /// <param name="value2">类型二对象</param>
  482. /// <param name="value3">类型三对象</param>
  483. /// <param name="value4">类型四对象</param>
  484. /// <param name="value5">类型五对象</param>
  485. /// <param name="value6">类型六对象</param>
  486. /// <param name="value7">类型七对象</param>
  487. /// <param name="value8">类型八对象</param>
  488. /// <returns>成的结果对象</returns>
  489. public static OperateResult<T1, T2, T3, T4, T5, T6, T7, T8> CreateSuccessResult<T1, T2, T3, T4, T5, T6, T7, T8>( T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8 )
  490. {
  491. return new OperateResult<T1, T2, T3, T4, T5, T6, T7, T8>( )
  492. {
  493. IsSuccess = true,
  494. ErrorCode = 0,
  495. Message = StringResources.Language.SuccessText,
  496. Content1 = value1,
  497. Content2 = value2,
  498. Content3 = value3,
  499. Content4 = value4,
  500. Content5 = value5,
  501. Content6 = value6,
  502. Content7 = value7,
  503. Content8 = value8,
  504. };
  505. }
  506. /// <summary>
  507. /// 创建并返回一个成功的结果对象,并带有九个参数对象
  508. /// </summary>
  509. /// <typeparam name="T1">第一个参数类型</typeparam>
  510. /// <typeparam name="T2">第二个参数类型</typeparam>
  511. /// <typeparam name="T3">第三个参数类型</typeparam>
  512. /// <typeparam name="T4">第四个参数类型</typeparam>
  513. /// <typeparam name="T5">第五个参数类型</typeparam>
  514. /// <typeparam name="T6">第六个参数类型</typeparam>
  515. /// <typeparam name="T7">第七个参数类型</typeparam>
  516. /// <typeparam name="T8">第八个参数类型</typeparam>
  517. /// <typeparam name="T9">第九个参数类型</typeparam>
  518. /// <param name="value1">类型一对象</param>
  519. /// <param name="value2">类型二对象</param>
  520. /// <param name="value3">类型三对象</param>
  521. /// <param name="value4">类型四对象</param>
  522. /// <param name="value5">类型五对象</param>
  523. /// <param name="value6">类型六对象</param>
  524. /// <param name="value7">类型七对象</param>
  525. /// <param name="value8">类型八对象</param>
  526. /// <param name="value9">类型九对象</param>
  527. /// <returns>成的结果对象</returns>
  528. public static OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9> CreateSuccessResult<T1, T2, T3, T4, T5, T6, T7, T8, T9>( T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9 )
  529. {
  530. return new OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9>( )
  531. {
  532. IsSuccess = true,
  533. ErrorCode = 0,
  534. Message = StringResources.Language.SuccessText,
  535. Content1 = value1,
  536. Content2 = value2,
  537. Content3 = value3,
  538. Content4 = value4,
  539. Content5 = value5,
  540. Content6 = value6,
  541. Content7 = value7,
  542. Content8 = value8,
  543. Content9 = value9,
  544. };
  545. }
  546. /// <summary>
  547. /// 创建并返回一个成功的结果对象,并带有十个参数对象
  548. /// </summary>
  549. /// <typeparam name="T1">第一个参数类型</typeparam>
  550. /// <typeparam name="T2">第二个参数类型</typeparam>
  551. /// <typeparam name="T3">第三个参数类型</typeparam>
  552. /// <typeparam name="T4">第四个参数类型</typeparam>
  553. /// <typeparam name="T5">第五个参数类型</typeparam>
  554. /// <typeparam name="T6">第六个参数类型</typeparam>
  555. /// <typeparam name="T7">第七个参数类型</typeparam>
  556. /// <typeparam name="T8">第八个参数类型</typeparam>
  557. /// <typeparam name="T9">第九个参数类型</typeparam>
  558. /// <typeparam name="T10">第十个参数类型</typeparam>
  559. /// <param name="value1">类型一对象</param>
  560. /// <param name="value2">类型二对象</param>
  561. /// <param name="value3">类型三对象</param>
  562. /// <param name="value4">类型四对象</param>
  563. /// <param name="value5">类型五对象</param>
  564. /// <param name="value6">类型六对象</param>
  565. /// <param name="value7">类型七对象</param>
  566. /// <param name="value8">类型八对象</param>
  567. /// <param name="value9">类型九对象</param>
  568. /// <param name="value10">类型十对象</param>
  569. /// <returns>成的结果对象</returns>
  570. public static OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> CreateSuccessResult<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10 )
  571. {
  572. return new OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( )
  573. {
  574. IsSuccess = true,
  575. ErrorCode = 0,
  576. Message = StringResources.Language.SuccessText,
  577. Content1 = value1,
  578. Content2 = value2,
  579. Content3 = value3,
  580. Content4 = value4,
  581. Content5 = value5,
  582. Content6 = value6,
  583. Content7 = value7,
  584. Content8 = value8,
  585. Content9 = value9,
  586. Content10 = value10,
  587. };
  588. }
  589. #endregion
  590. }
  591. /// <summary>
  592. /// 操作结果的泛型类,允许带一个用户自定义的泛型对象,推荐使用这个类
  593. /// </summary>
  594. /// <typeparam name="T">泛型类</typeparam>
  595. public class OperateResult<T> : OperateResult
  596. {
  597. #region Constructor
  598. /// <summary>
  599. /// 实例化一个默认的结果对象
  600. /// </summary>
  601. public OperateResult( ) : base( )
  602. {
  603. }
  604. /// <summary>
  605. /// 使用指定的消息实例化一个默认的结果对象
  606. /// </summary>
  607. /// <param name="msg">错误消息</param>
  608. public OperateResult( string msg ) : base( msg )
  609. {
  610. }
  611. /// <summary>
  612. /// 使用错误代码,消息文本来实例化对象
  613. /// </summary>
  614. /// <param name="err">错误代码</param>
  615. /// <param name="msg">错误消息</param>
  616. public OperateResult( int err, string msg ) : base( err, msg )
  617. {
  618. }
  619. #endregion
  620. /// <summary>
  621. /// 用户自定义的泛型数据
  622. /// </summary>
  623. public T Content { get; set; }
  624. }
  625. /// <summary>
  626. /// 操作结果的泛型类,允许带两个用户自定义的泛型对象,推荐使用这个类
  627. /// </summary>
  628. /// <typeparam name="T1">泛型类</typeparam>
  629. /// <typeparam name="T2">泛型类</typeparam>
  630. public class OperateResult<T1, T2> : OperateResult
  631. {
  632. #region Constructor
  633. /// <summary>
  634. /// 实例化一个默认的结果对象
  635. /// </summary>
  636. public OperateResult( ) : base( )
  637. {
  638. }
  639. /// <summary>
  640. /// 使用指定的消息实例化一个默认的结果对象
  641. /// </summary>
  642. /// <param name="msg">错误消息</param>
  643. public OperateResult( string msg ) : base( msg )
  644. {
  645. }
  646. /// <summary>
  647. /// 使用错误代码,消息文本来实例化对象
  648. /// </summary>
  649. /// <param name="err">错误代码</param>
  650. /// <param name="msg">错误消息</param>
  651. public OperateResult( int err, string msg ) : base( err, msg )
  652. {
  653. }
  654. #endregion
  655. /// <summary>
  656. /// 用户自定义的泛型数据1
  657. /// </summary>
  658. public T1 Content1 { get; set; }
  659. /// <summary>
  660. /// 用户自定义的泛型数据2
  661. /// </summary>
  662. public T2 Content2 { get; set; }
  663. }
  664. /// <summary>
  665. /// 操作结果的泛型类,允许带三个用户自定义的泛型对象,推荐使用这个类
  666. /// </summary>
  667. /// <typeparam name="T1">泛型类</typeparam>
  668. /// <typeparam name="T2">泛型类</typeparam>
  669. /// <typeparam name="T3">泛型类</typeparam>
  670. public class OperateResult<T1, T2, T3> : OperateResult
  671. {
  672. #region Constructor
  673. /// <summary>
  674. /// 实例化一个默认的结果对象
  675. /// </summary>
  676. public OperateResult( ) : base( )
  677. {
  678. }
  679. /// <summary>
  680. /// 使用指定的消息实例化一个默认的结果对象
  681. /// </summary>
  682. /// <param name="msg">错误消息</param>
  683. public OperateResult( string msg ) : base( msg )
  684. {
  685. }
  686. /// <summary>
  687. /// 使用错误代码,消息文本来实例化对象
  688. /// </summary>
  689. /// <param name="err">错误代码</param>
  690. /// <param name="msg">错误消息</param>
  691. public OperateResult( int err, string msg ) : base( err, msg )
  692. {
  693. }
  694. #endregion
  695. /// <summary>
  696. /// 用户自定义的泛型数据1
  697. /// </summary>
  698. public T1 Content1 { get; set; }
  699. /// <summary>
  700. /// 用户自定义的泛型数据2
  701. /// </summary>
  702. public T2 Content2 { get; set; }
  703. /// <summary>
  704. /// 用户自定义的泛型数据3
  705. /// </summary>
  706. public T3 Content3 { get; set; }
  707. }
  708. /// <summary>
  709. /// 操作结果的泛型类,允许带四个用户自定义的泛型对象,推荐使用这个类
  710. /// </summary>
  711. /// <typeparam name="T1">泛型类</typeparam>
  712. /// <typeparam name="T2">泛型类</typeparam>
  713. /// <typeparam name="T3">泛型类</typeparam>
  714. /// <typeparam name="T4">泛型类</typeparam>
  715. public class OperateResult<T1, T2, T3, T4> : OperateResult
  716. {
  717. #region Constructor
  718. /// <summary>
  719. /// 实例化一个默认的结果对象
  720. /// </summary>
  721. public OperateResult( ) : base( )
  722. {
  723. }
  724. /// <summary>
  725. /// 使用指定的消息实例化一个默认的结果对象
  726. /// </summary>
  727. /// <param name="msg">错误消息</param>
  728. public OperateResult( string msg ) : base( msg )
  729. {
  730. }
  731. /// <summary>
  732. /// 使用错误代码,消息文本来实例化对象
  733. /// </summary>
  734. /// <param name="err">错误代码</param>
  735. /// <param name="msg">错误消息</param>
  736. public OperateResult( int err, string msg ) : base( err, msg )
  737. {
  738. }
  739. #endregion
  740. /// <summary>
  741. /// 用户自定义的泛型数据1
  742. /// </summary>
  743. public T1 Content1 { get; set; }
  744. /// <summary>
  745. /// 用户自定义的泛型数据2
  746. /// </summary>
  747. public T2 Content2 { get; set; }
  748. /// <summary>
  749. /// 用户自定义的泛型数据3
  750. /// </summary>
  751. public T3 Content3 { get; set; }
  752. /// <summary>
  753. /// 用户自定义的泛型数据4
  754. /// </summary>
  755. public T4 Content4 { get; set; }
  756. }
  757. /// <summary>
  758. /// 操作结果的泛型类,允许带五个用户自定义的泛型对象,推荐使用这个类
  759. /// </summary>
  760. /// <typeparam name="T1">泛型类</typeparam>
  761. /// <typeparam name="T2">泛型类</typeparam>
  762. /// <typeparam name="T3">泛型类</typeparam>
  763. /// <typeparam name="T4">泛型类</typeparam>
  764. /// <typeparam name="T5">泛型类</typeparam>
  765. public class OperateResult<T1, T2, T3, T4, T5> : OperateResult
  766. {
  767. #region Constructor
  768. /// <summary>
  769. /// 实例化一个默认的结果对象
  770. /// </summary>
  771. public OperateResult( ) : base( )
  772. {
  773. }
  774. /// <summary>
  775. /// 使用指定的消息实例化一个默认的结果对象
  776. /// </summary>
  777. /// <param name="msg">错误消息</param>
  778. public OperateResult( string msg ) : base( msg )
  779. {
  780. }
  781. /// <summary>
  782. /// 使用错误代码,消息文本来实例化对象
  783. /// </summary>
  784. /// <param name="err">错误代码</param>
  785. /// <param name="msg">错误消息</param>
  786. public OperateResult( int err, string msg ) : base( err, msg )
  787. {
  788. }
  789. #endregion
  790. /// <summary>
  791. /// 用户自定义的泛型数据1
  792. /// </summary>
  793. public T1 Content1 { get; set; }
  794. /// <summary>
  795. /// 用户自定义的泛型数据2
  796. /// </summary>
  797. public T2 Content2 { get; set; }
  798. /// <summary>
  799. /// 用户自定义的泛型数据3
  800. /// </summary>
  801. public T3 Content3 { get; set; }
  802. /// <summary>
  803. /// 用户自定义的泛型数据4
  804. /// </summary>
  805. public T4 Content4 { get; set; }
  806. /// <summary>
  807. /// 用户自定义的泛型数据5
  808. /// </summary>
  809. public T5 Content5 { get; set; }
  810. }
  811. /// <summary>
  812. /// 操作结果的泛型类,允许带六个用户自定义的泛型对象,推荐使用这个类
  813. /// </summary>
  814. /// <typeparam name="T1">泛型类</typeparam>
  815. /// <typeparam name="T2">泛型类</typeparam>
  816. /// <typeparam name="T3">泛型类</typeparam>
  817. /// <typeparam name="T4">泛型类</typeparam>
  818. /// <typeparam name="T5">泛型类</typeparam>
  819. /// <typeparam name="T6">泛型类</typeparam>
  820. public class OperateResult<T1, T2, T3, T4, T5, T6> : OperateResult
  821. {
  822. #region Constructor
  823. /// <summary>
  824. /// 实例化一个默认的结果对象
  825. /// </summary>
  826. public OperateResult( ) : base( )
  827. {
  828. }
  829. /// <summary>
  830. /// 使用指定的消息实例化一个默认的结果对象
  831. /// </summary>
  832. /// <param name="msg">错误消息</param>
  833. public OperateResult( string msg ) : base( msg )
  834. {
  835. }
  836. /// <summary>
  837. /// 使用错误代码,消息文本来实例化对象
  838. /// </summary>
  839. /// <param name="err">错误代码</param>
  840. /// <param name="msg">错误消息</param>
  841. public OperateResult( int err, string msg ) : base( err, msg )
  842. {
  843. }
  844. #endregion
  845. /// <summary>
  846. /// 用户自定义的泛型数据1
  847. /// </summary>
  848. public T1 Content1 { get; set; }
  849. /// <summary>
  850. /// 用户自定义的泛型数据2
  851. /// </summary>
  852. public T2 Content2 { get; set; }
  853. /// <summary>
  854. /// 用户自定义的泛型数据3
  855. /// </summary>
  856. public T3 Content3 { get; set; }
  857. /// <summary>
  858. /// 用户自定义的泛型数据4
  859. /// </summary>
  860. public T4 Content4 { get; set; }
  861. /// <summary>
  862. /// 用户自定义的泛型数据5
  863. /// </summary>
  864. public T5 Content5 { get; set; }
  865. /// <summary>
  866. /// 用户自定义的泛型数据5
  867. /// </summary>
  868. public T6 Content6 { get; set; }
  869. }
  870. /// <summary>
  871. /// 操作结果的泛型类,允许带七个用户自定义的泛型对象,推荐使用这个类
  872. /// </summary>
  873. /// <typeparam name="T1">泛型类</typeparam>
  874. /// <typeparam name="T2">泛型类</typeparam>
  875. /// <typeparam name="T3">泛型类</typeparam>
  876. /// <typeparam name="T4">泛型类</typeparam>
  877. /// <typeparam name="T5">泛型类</typeparam>
  878. /// <typeparam name="T6">泛型类</typeparam>
  879. /// <typeparam name="T7">泛型类</typeparam>
  880. public class OperateResult<T1, T2, T3, T4, T5, T6, T7> : OperateResult
  881. {
  882. #region Constructor
  883. /// <summary>
  884. /// 实例化一个默认的结果对象
  885. /// </summary>
  886. public OperateResult( ) : base( )
  887. {
  888. }
  889. /// <summary>
  890. /// 使用指定的消息实例化一个默认的结果对象
  891. /// </summary>
  892. /// <param name="msg">错误消息</param>
  893. public OperateResult( string msg ) : base( msg )
  894. {
  895. }
  896. /// <summary>
  897. /// 使用错误代码,消息文本来实例化对象
  898. /// </summary>
  899. /// <param name="err">错误代码</param>
  900. /// <param name="msg">错误消息</param>
  901. public OperateResult( int err, string msg ) : base( err, msg )
  902. {
  903. }
  904. #endregion
  905. /// <summary>
  906. /// 用户自定义的泛型数据1
  907. /// </summary>
  908. public T1 Content1 { get; set; }
  909. /// <summary>
  910. /// 用户自定义的泛型数据2
  911. /// </summary>
  912. public T2 Content2 { get; set; }
  913. /// <summary>
  914. /// 用户自定义的泛型数据3
  915. /// </summary>
  916. public T3 Content3 { get; set; }
  917. /// <summary>
  918. /// 用户自定义的泛型数据4
  919. /// </summary>
  920. public T4 Content4 { get; set; }
  921. /// <summary>
  922. /// 用户自定义的泛型数据5
  923. /// </summary>
  924. public T5 Content5 { get; set; }
  925. /// <summary>
  926. /// 用户自定义的泛型数据6
  927. /// </summary>
  928. public T6 Content6 { get; set; }
  929. /// <summary>
  930. /// 用户自定义的泛型数据7
  931. /// </summary>
  932. public T7 Content7 { get; set; }
  933. }
  934. /// <summary>
  935. /// 操作结果的泛型类,允许带八个用户自定义的泛型对象,推荐使用这个类
  936. /// </summary>
  937. /// <typeparam name="T1">泛型类</typeparam>
  938. /// <typeparam name="T2">泛型类</typeparam>
  939. /// <typeparam name="T3">泛型类</typeparam>
  940. /// <typeparam name="T4">泛型类</typeparam>
  941. /// <typeparam name="T5">泛型类</typeparam>
  942. /// <typeparam name="T6">泛型类</typeparam>
  943. /// <typeparam name="T7">泛型类</typeparam>
  944. /// <typeparam name="T8">泛型类</typeparam>
  945. public class OperateResult<T1, T2, T3, T4, T5, T6, T7, T8> : OperateResult
  946. {
  947. #region Constructor
  948. /// <summary>
  949. /// 实例化一个默认的结果对象
  950. /// </summary>
  951. public OperateResult( ) : base( )
  952. {
  953. }
  954. /// <summary>
  955. /// 使用指定的消息实例化一个默认的结果对象
  956. /// </summary>
  957. /// <param name="msg">错误消息</param>
  958. public OperateResult( string msg ) : base( msg )
  959. {
  960. }
  961. /// <summary>
  962. /// 使用错误代码,消息文本来实例化对象
  963. /// </summary>
  964. /// <param name="err">错误代码</param>
  965. /// <param name="msg">错误消息</param>
  966. public OperateResult( int err, string msg ) : base( err, msg )
  967. {
  968. }
  969. #endregion
  970. /// <summary>
  971. /// 用户自定义的泛型数据1
  972. /// </summary>
  973. public T1 Content1 { get; set; }
  974. /// <summary>
  975. /// 用户自定义的泛型数据2
  976. /// </summary>
  977. public T2 Content2 { get; set; }
  978. /// <summary>
  979. /// 用户自定义的泛型数据3
  980. /// </summary>
  981. public T3 Content3 { get; set; }
  982. /// <summary>
  983. /// 用户自定义的泛型数据4
  984. /// </summary>
  985. public T4 Content4 { get; set; }
  986. /// <summary>
  987. /// 用户自定义的泛型数据5
  988. /// </summary>
  989. public T5 Content5 { get; set; }
  990. /// <summary>
  991. /// 用户自定义的泛型数据6
  992. /// </summary>
  993. public T6 Content6 { get; set; }
  994. /// <summary>
  995. /// 用户自定义的泛型数据7
  996. /// </summary>
  997. public T7 Content7 { get; set; }
  998. /// <summary>
  999. /// 用户自定义的泛型数据8
  1000. /// </summary>
  1001. public T8 Content8 { get; set; }
  1002. }
  1003. /// <summary>
  1004. /// 操作结果的泛型类,允许带九个用户自定义的泛型对象,推荐使用这个类
  1005. /// </summary>
  1006. /// <typeparam name="T1">泛型类</typeparam>
  1007. /// <typeparam name="T2">泛型类</typeparam>
  1008. /// <typeparam name="T3">泛型类</typeparam>
  1009. /// <typeparam name="T4">泛型类</typeparam>
  1010. /// <typeparam name="T5">泛型类</typeparam>
  1011. /// <typeparam name="T6">泛型类</typeparam>
  1012. /// <typeparam name="T7">泛型类</typeparam>
  1013. /// <typeparam name="T8">泛型类</typeparam>
  1014. /// <typeparam name="T9">泛型类</typeparam>
  1015. public class OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9> : OperateResult
  1016. {
  1017. #region Constructor
  1018. /// <summary>
  1019. /// 实例化一个默认的结果对象
  1020. /// </summary>
  1021. public OperateResult( ) : base( )
  1022. {
  1023. }
  1024. /// <summary>
  1025. /// 使用指定的消息实例化一个默认的结果对象
  1026. /// </summary>
  1027. /// <param name="msg">错误消息</param>
  1028. public OperateResult( string msg ) : base( msg )
  1029. {
  1030. }
  1031. /// <summary>
  1032. /// 使用错误代码,消息文本来实例化对象
  1033. /// </summary>
  1034. /// <param name="err">错误代码</param>
  1035. /// <param name="msg">错误消息</param>
  1036. public OperateResult( int err, string msg ) : base( err, msg )
  1037. {
  1038. }
  1039. #endregion
  1040. /// <summary>
  1041. /// 用户自定义的泛型数据1
  1042. /// </summary>
  1043. public T1 Content1 { get; set; }
  1044. /// <summary>
  1045. /// 用户自定义的泛型数据2
  1046. /// </summary>
  1047. public T2 Content2 { get; set; }
  1048. /// <summary>
  1049. /// 用户自定义的泛型数据3
  1050. /// </summary>
  1051. public T3 Content3 { get; set; }
  1052. /// <summary>
  1053. /// 用户自定义的泛型数据4
  1054. /// </summary>
  1055. public T4 Content4 { get; set; }
  1056. /// <summary>
  1057. /// 用户自定义的泛型数据5
  1058. /// </summary>
  1059. public T5 Content5 { get; set; }
  1060. /// <summary>
  1061. /// 用户自定义的泛型数据6
  1062. /// </summary>
  1063. public T6 Content6 { get; set; }
  1064. /// <summary>
  1065. /// 用户自定义的泛型数据7
  1066. /// </summary>
  1067. public T7 Content7 { get; set; }
  1068. /// <summary>
  1069. /// 用户自定义的泛型数据8
  1070. /// </summary>
  1071. public T8 Content8 { get; set; }
  1072. /// <summary>
  1073. /// 用户自定义的泛型数据9
  1074. /// </summary>
  1075. public T9 Content9 { get; set; }
  1076. }
  1077. /// <summary>
  1078. /// 操作结果的泛型类,允许带十个用户自定义的泛型对象,推荐使用这个类
  1079. /// </summary>
  1080. /// <typeparam name="T1">泛型类</typeparam>
  1081. /// <typeparam name="T2">泛型类</typeparam>
  1082. /// <typeparam name="T3">泛型类</typeparam>
  1083. /// <typeparam name="T4">泛型类</typeparam>
  1084. /// <typeparam name="T5">泛型类</typeparam>
  1085. /// <typeparam name="T6">泛型类</typeparam>
  1086. /// <typeparam name="T7">泛型类</typeparam>
  1087. /// <typeparam name="T8">泛型类</typeparam>
  1088. /// <typeparam name="T9">泛型类</typeparam>
  1089. /// <typeparam name="T10">泛型类</typeparam>
  1090. public class OperateResult<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : OperateResult
  1091. {
  1092. #region Constructor
  1093. /// <summary>
  1094. /// 实例化一个默认的结果对象
  1095. /// </summary>
  1096. public OperateResult( ) : base( )
  1097. {
  1098. }
  1099. /// <summary>
  1100. /// 使用指定的消息实例化一个默认的结果对象
  1101. /// </summary>
  1102. /// <param name="msg">错误消息</param>
  1103. public OperateResult( string msg ) : base( msg )
  1104. {
  1105. }
  1106. /// <summary>
  1107. /// 使用错误代码,消息文本来实例化对象
  1108. /// </summary>
  1109. /// <param name="err">错误代码</param>
  1110. /// <param name="msg">错误消息</param>
  1111. public OperateResult( int err, string msg ) : base( err, msg )
  1112. {
  1113. }
  1114. #endregion
  1115. /// <summary>
  1116. /// 用户自定义的泛型数据1
  1117. /// </summary>
  1118. public T1 Content1 { get; set; }
  1119. /// <summary>
  1120. /// 用户自定义的泛型数据2
  1121. /// </summary>
  1122. public T2 Content2 { get; set; }
  1123. /// <summary>
  1124. /// 用户自定义的泛型数据3
  1125. /// </summary>
  1126. public T3 Content3 { get; set; }
  1127. /// <summary>
  1128. /// 用户自定义的泛型数据4
  1129. /// </summary>
  1130. public T4 Content4 { get; set; }
  1131. /// <summary>
  1132. /// 用户自定义的泛型数据5
  1133. /// </summary>
  1134. public T5 Content5 { get; set; }
  1135. /// <summary>
  1136. /// 用户自定义的泛型数据6
  1137. /// </summary>
  1138. public T6 Content6 { get; set; }
  1139. /// <summary>
  1140. /// 用户自定义的泛型数据7
  1141. /// </summary>
  1142. public T7 Content7 { get; set; }
  1143. /// <summary>
  1144. /// 用户自定义的泛型数据8
  1145. /// </summary>
  1146. public T8 Content8 { get; set; }
  1147. /// <summary>
  1148. /// 用户自定义的泛型数据9
  1149. /// </summary>
  1150. public T9 Content9 { get; set; }
  1151. /// <summary>
  1152. /// 用户自定义的泛型数据10
  1153. /// </summary>
  1154. public T10 Content10 { get; set; }
  1155. }
  1156. }