AzureStorageTableExtensions.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. using Microsoft.Azure.Cosmos.Table;
  2. using Microsoft.Azure.Cosmos.Table.Queryable;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. using System.Linq;
  10. using TEAMModelOS.SDK;
  11. using System.Reflection;
  12. using HTEXLib.COMM.Helpers;
  13. namespace TEAMModelOS.SDK.DI
  14. {
  15. public static class AzureStorageTableExtensions
  16. {
  17. #region CloudTable 批次操作
  18. /// <summary>
  19. /// 批次新增資料至Table儲存區。
  20. /// </summary>
  21. /// <param name="entities">欲快取的集合</param>
  22. /// <returns></returns>
  23. public static async Task<TableBatchResult> BatchInsertAsync<T>(this CloudTable table, IEnumerable<T> entities) where T : ITableEntity, new()
  24. {
  25. TableBatchOperation batchOperation = new TableBatchOperation();
  26. foreach (var cache in entities)
  27. {
  28. batchOperation.Insert(cache);
  29. }
  30. return await table.ExecuteBatchAsync(batchOperation);
  31. }
  32. #endregion
  33. #region CloudTable Get
  34. /// <summary>
  35. /// (同步)取得 table 中指定 PartitionKey 的所有集合。
  36. /// </summary>
  37. /// <returns></returns>
  38. public static IEnumerable<T> Get<T>(this CloudTable table, string partitionKey) where T : ITableEntity, new()
  39. {
  40. TableQuery<T> query = new TableQuery<T>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey));
  41. return table.ExecuteQuery(query);
  42. }
  43. /// <summary>
  44. /// (同步)取得指定 PartitionKey與 RowKey 的數據,效能:點查詢,最佳。
  45. /// </summary>
  46. /// <typeparam name="T">T</typeparam>
  47. /// <param name="partitionKey">PartitionKey</param>
  48. /// <param name="rowKey">RowKey</param>
  49. /// <returns></returns>
  50. public static T Get<T>(this CloudTable table, string partitionKey, string rowKey) where T : ITableEntity, new()
  51. {
  52. TableOperation retrieveOperation = TableOperation.Retrieve<T>(partitionKey, rowKey);
  53. var retrieveResult = table.Execute(retrieveOperation);
  54. if (retrieveResult.Result != null)
  55. {
  56. //DynamicTableEntityJsonSeria1lizer
  57. return (T)retrieveResult.Result;
  58. }
  59. else
  60. {
  61. return default;
  62. }
  63. }
  64. public static DynamicTableEntity Get(this CloudTable table, string partitionKey, string rowKey)
  65. {
  66. TableOperation retrieveOperation = TableOperation.Retrieve(partitionKey, rowKey);
  67. var retrieveResult = table.Execute(retrieveOperation);
  68. if (retrieveResult.Result != null)
  69. {
  70. return retrieveResult.Result as DynamicTableEntity;
  71. }
  72. else
  73. {
  74. return null;
  75. }
  76. }
  77. /// <summary>
  78. /// 取得指定 PartitionKey 的所有集合(分頁),效能:範圍查詢,次佳。
  79. /// </summary>
  80. /// <typeparam name="T">T</typeparam>
  81. /// <param name="partitionKey">PartitionKey</param>
  82. /// <param name="takeCount">指定每次返回數量</param>
  83. /// <param name="specifyPropertys">指定只須返回的屬性,效能:伺服器端預測,降低延遲和成本</param>
  84. /// <param name="onProgress">要返回集合的委派</param>
  85. /// <param name="ct">CancellationToken</param>
  86. /// <returns></returns>
  87. public static async Task GetAsync<T>(this CloudTable table, string partitionKey, int? takeCount = null, List<string> specifyPropertys = null, Action<IList<T>> onProgress = null, CancellationToken ct = default(CancellationToken)) where T : ITableEntity, new()
  88. {
  89. TableQuery<T> tableQuery = null;
  90. TableContinuationToken token = null;
  91. var filter = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey);
  92. if (specifyPropertys != null)
  93. tableQuery = new TableQuery<T>().Where(filter).Select(specifyPropertys);
  94. else
  95. tableQuery = new TableQuery<T>().Where(filter);
  96. if (takeCount != null) tableQuery.TakeCount = takeCount;
  97. do
  98. {
  99. var queryResponse = await table.ExecuteQuerySegmentedAsync(tableQuery, token);
  100. token = queryResponse.ContinuationToken;
  101. onProgress?.Invoke(queryResponse.Results);
  102. } while (token != null && !ct.IsCancellationRequested);
  103. }
  104. /// <summary>
  105. /// 取得指定 PartitionKey 的所有集合,效能:範圍查詢,次佳。
  106. /// </summary>
  107. /// <typeparam name="T">T</typeparam>
  108. /// <param name="partitionKey">PartitionKey</param>
  109. /// <param name="takeCount">指定每次返回數量</param>
  110. /// <param name="specifyPropertys">指定只須返回的屬性,效能:伺服器端預測,降低延遲和成本</param>
  111. /// <param name="onProgress">要返回集合的委派</param>
  112. /// <param name="ct">CancellationToken</param>
  113. /// <returns></returns>
  114. public static async Task<IEnumerable<T>> GetAsync<T>(this CloudTable table, string partitionKey, int? takeCount = null, List<string> specifyPropertys = null, CancellationToken ct = default(CancellationToken)) where T : ITableEntity, new()
  115. {
  116. TableQuery<T> tableQuery = null;
  117. TableContinuationToken token = null;
  118. var filter = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey);
  119. if (specifyPropertys != null)
  120. tableQuery = new TableQuery<T>().Where(filter).Select(specifyPropertys);
  121. else
  122. tableQuery = new TableQuery<T>().Where(filter);
  123. if (takeCount != null) tableQuery.TakeCount = takeCount;
  124. var items = new List<T>();
  125. do
  126. {
  127. var queryResponse = await table.ExecuteQuerySegmentedAsync(tableQuery, token);
  128. token = queryResponse.ContinuationToken;
  129. items.AddRange(queryResponse.Results);
  130. } while (token != null && !ct.IsCancellationRequested);
  131. return items;
  132. }
  133. /// <summary>
  134. /// 傳回指定partitionKey的Count數量
  135. /// </summary>
  136. /// <param name="partitionKey"></param>
  137. /// <returns></returns>
  138. public static int GetCount(this CloudTable table, string partitionKey)
  139. {
  140. TableQuery query = new TableQuery().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey)).Select(new List<string> { "PartitionKey" });
  141. var queryResponse = table.ExecuteQuery(query).ToList();
  142. return queryResponse.Count();
  143. }
  144. #endregion
  145. #region CloudTable Get All
  146. /// <summary>
  147. /// (同步)取得 table 的所有集合,效能:資料表掃描,不佳。
  148. /// </summary>
  149. /// <returns></returns>
  150. public static IEnumerable<T> GetAll<T>(this CloudTable table) where T : ITableEntity, new()
  151. {
  152. return table.ExecuteQuery(new TableQuery<T>());
  153. }
  154. /// <summary>
  155. /// 取得 table 的所有集合(分頁),效能:資料表掃描,不佳。
  156. /// </summary>
  157. /// <param name="takeCount">指定每次返回數量</param>
  158. /// <param name="specifyPropertys">指定只須返回的屬性,效能:伺服器端預測,降低延遲和成本</param>
  159. /// <param name="onProgress">要返回集合的委派</param>
  160. /// <returns></returns>
  161. public static async Task GetAllAsync<T>(this CloudTable table, int? takeCount = null, List<string> specifyPropertys = null, Action<IList<T>> onProgress = null, CancellationToken ct = default(CancellationToken)) where T : ITableEntity, new()
  162. {
  163. TableContinuationToken token = null;
  164. TableQuery<T> tableQuery = new TableQuery<T>();
  165. if (specifyPropertys != null)
  166. tableQuery = new TableQuery<T>().Select(specifyPropertys);
  167. else
  168. tableQuery = new TableQuery<T>();
  169. if (takeCount != null) tableQuery.TakeCount = takeCount;
  170. var items = new List<T>();
  171. do
  172. {
  173. var queryResponse = await table.ExecuteQuerySegmentedAsync(tableQuery, token);
  174. token = queryResponse.ContinuationToken;
  175. items.AddRange(queryResponse.Results);
  176. onProgress?.Invoke(queryResponse.Results);
  177. } while (token != null && !ct.IsCancellationRequested);
  178. }
  179. /// <summary>
  180. /// 取得 table 的所有集合,效能:資料表掃描,不佳。
  181. /// </summary>
  182. /// <param name="takeCount">指定每次返回數量</param>
  183. /// <param name="specifyPropertys">指定只須返回的屬性,效能:伺服器端預測,降低延遲和成本</param>
  184. /// <returns></returns>
  185. public static async Task<IEnumerable<T>> GetAllAsync<T>(this CloudTable table, int? takeCount = null, List<string> specifyPropertys = null, CancellationToken ct = default(CancellationToken)) where T : ITableEntity, new()
  186. {
  187. TableContinuationToken token = null;
  188. TableQuery<T> tableQuery = new TableQuery<T>();
  189. if (takeCount != null) tableQuery.TakeCount = takeCount;
  190. if (specifyPropertys != null)
  191. tableQuery = new TableQuery<T>().Select(specifyPropertys);
  192. else
  193. tableQuery = new TableQuery<T>();
  194. var items = new List<T>();
  195. do
  196. {
  197. var queryResponse = await table.ExecuteQuerySegmentedAsync(tableQuery, token);
  198. token = queryResponse.ContinuationToken;
  199. items.AddRange(queryResponse.Results);
  200. } while (token != null && !ct.IsCancellationRequested);
  201. return items;
  202. }
  203. #endregion
  204. public static async Task<T> Save<T>(this CloudTable table, TableEntity entity) where T : TableEntity, new()
  205. {
  206. TableResult result = await table.ExecuteAsync(TableOperation.Insert(entity));
  207. return result.Result as T;
  208. }
  209. public static async Task<T> SaveOrUpdate<T>(this CloudTable table, TableEntity entity) where T : TableEntity, new()
  210. {
  211. TableResult result = await table.ExecuteAsync(TableOperation.InsertOrReplace(entity));
  212. return result.Result as T;
  213. }
  214. public static async Task<T> Update<T>(this CloudTable table, TableEntity entity) where T : TableEntity, new()
  215. {
  216. TableResult result = await table.ExecuteAsync(TableOperation.Replace(entity));
  217. return result.Result as T;
  218. }
  219. public static async Task<T> Delete<T>(this CloudTable table, TableEntity entity) where T : TableEntity, new()
  220. {
  221. TableResult result = await table.ExecuteAsync(TableOperation.Delete(entity));
  222. return result.Result as T;
  223. }
  224. public static async Task<List<T>> DeleteAll<T>(this CloudTable table, List<T> entitys) where T : TableEntity, new()
  225. {
  226. if (!entitys.IsNotEmpty())
  227. {
  228. return null;
  229. }
  230. IList<Dictionary<string, List<T>>> listInfo = new List<Dictionary<string, List<T>>>();
  231. foreach (IGrouping<string, T> group in entitys.GroupBy(c => c.PartitionKey))
  232. {
  233. Dictionary<string, List<T>> dictInfo = new()
  234. {
  235. { group.Key, group.ToList() }
  236. };
  237. listInfo.Add(dictInfo);
  238. }
  239. foreach (Dictionary<string, List<T>> dict in listInfo)
  240. {
  241. IList<TableResult> result = null;
  242. foreach (string key in dict.Keys)
  243. {
  244. List<T> values = dict[key];
  245. int pageSize = 100;
  246. int pages = (int)Math.Ceiling((double)values.Count / pageSize);
  247. for (int i = 0; i < pages; i++)
  248. {
  249. List<T> lists = values.Skip((i) * pageSize).Take(pageSize).ToList();
  250. TableBatchOperation batchOperation = new();
  251. for (int j = 0; j < lists.Count; j++)
  252. {
  253. batchOperation.Delete(lists[j]);
  254. }
  255. result = await table.ExecuteBatchAsync(batchOperation);
  256. }
  257. }
  258. }
  259. return entitys;
  260. }
  261. public static async Task<List<T>> SaveOrUpdateAll<T>(this CloudTable table, List<T> entitys) where T : TableEntity, new()
  262. {
  263. if (!entitys.IsNotEmpty()) return null;
  264. IList<Dictionary<string, List<T>>> listInfo = new List<Dictionary<string, List<T>>>();
  265. foreach (IGrouping<string, T> group in entitys.GroupBy(c => c.PartitionKey))
  266. {
  267. Dictionary<string, List<T>> dictInfo = new Dictionary<string, List<T>>
  268. {
  269. { group.Key, group.ToList() }
  270. };
  271. listInfo.Add(dictInfo);
  272. }
  273. foreach (Dictionary<string, List<T>> dict in listInfo)
  274. {
  275. IList<TableResult> result = null;
  276. foreach (string key in dict.Keys)
  277. {
  278. List<T> values = dict[key];
  279. int pageSize = 100;
  280. int pages = (int)Math.Ceiling((double)values.Count / pageSize);
  281. for (int i = 0; i < pages; i++)
  282. {
  283. List<T> lists = values.Skip((i) * pageSize).Take(pageSize).ToList();
  284. TableBatchOperation batchOperation = new TableBatchOperation();
  285. for (int j = 0; j < lists.Count; j++)
  286. {
  287. batchOperation.InsertOrReplace(lists[j]);
  288. }
  289. result = await table.ExecuteBatchAsync(batchOperation);
  290. }
  291. }
  292. }
  293. return entitys;
  294. }
  295. public static async Task<List<T>> UpdateAll<T>(this CloudTable table, List<T> entitys) where T : TableEntity, new()
  296. {
  297. if (!entitys.IsNotEmpty()) return null;
  298. IList<Dictionary<string, List<T>>> listInfo = new List<Dictionary<string, List<T>>>();
  299. foreach (IGrouping<string, T> group in entitys.GroupBy(c => c.PartitionKey))
  300. {
  301. Dictionary<string, List<T>> dictInfo = new Dictionary<string, List<T>>
  302. {
  303. { group.Key, group.ToList() }
  304. };
  305. listInfo.Add(dictInfo);
  306. }
  307. foreach (Dictionary<string, List<T>> dict in listInfo)
  308. {
  309. IList<TableResult> result = null;
  310. foreach (string key in dict.Keys)
  311. {
  312. List<T> values = dict[key];
  313. int pageSize = 100;
  314. int pages = (int)Math.Ceiling((double)values.Count / pageSize);
  315. for (int i = 0; i < pages; i++)
  316. {
  317. List<T> lists = values.Skip((i) * pageSize).Take(pageSize).ToList();
  318. TableBatchOperation batchOperation = new TableBatchOperation();
  319. for (int j = 0; j < lists.Count; j++)
  320. {
  321. batchOperation.Replace(lists[j]);
  322. }
  323. result = await table.ExecuteBatchAsync(batchOperation);
  324. }
  325. }
  326. }
  327. return entitys;
  328. }
  329. public static async Task<List<T>> SaveAll<T>(this CloudTable table, List<T> entitys) where T : TableEntity, new()
  330. {
  331. if (!entitys.IsNotEmpty()) return null;
  332. IList<Dictionary<string, List<T>>> listInfo = new List<Dictionary<string, List<T>>>();
  333. foreach (IGrouping<string, T> group in entitys.GroupBy(c => c.PartitionKey))
  334. {
  335. Dictionary<string, List<T>> dictInfo = new Dictionary<string, List<T>>
  336. {
  337. { group.Key, group.ToList() }
  338. };
  339. listInfo.Add(dictInfo);
  340. }
  341. foreach (Dictionary<string, List<T>> dict in listInfo)
  342. {
  343. IList<TableResult> result = null;
  344. foreach (string key in dict.Keys)
  345. {
  346. List<T> values = dict[key];
  347. int pageSize = 100;
  348. int pages = (int)Math.Ceiling((double)values.Count / pageSize);
  349. for (int i = 0; i < pages; i++)
  350. {
  351. List<T> lists = values.Skip((i) * pageSize).Take(pageSize).ToList();
  352. TableBatchOperation batchOperation = new TableBatchOperation();
  353. for (int j = 0; j < lists.Count; j++)
  354. {
  355. batchOperation.Insert(lists[j]);
  356. }
  357. result = await table.ExecuteBatchAsync(batchOperation);
  358. }
  359. }
  360. }
  361. return entitys;
  362. }
  363. public static async Task<List<T>> FindListByDict<T>(this CloudTable table, Dictionary<string, object> dict) where T : TableEntity, new()
  364. {
  365. var exQuery = new TableQuery<T>();
  366. StringBuilder builder = new();
  367. if (null != dict && dict.Count > 0)
  368. {
  369. var keys = dict.Keys;
  370. int index = 1;
  371. foreach (string key in keys)
  372. {
  373. if (dict[key] != null && !string.IsNullOrEmpty(dict[key].ToString()))
  374. {
  375. string typeStr = SwitchType<T>(dict[key], key);
  376. if (string.IsNullOrEmpty(typeStr))
  377. {
  378. continue;
  379. }
  380. if (index == 1)
  381. {
  382. //builder.Append(TableQuery.GenerateFilterCondition(key, QueryComparisons.Equal, dict[key].ToString()));
  383. builder.Append(typeStr);
  384. }
  385. else
  386. {
  387. //builder.Append(" " + TableOperators.And + " " + TableQuery.GenerateFilterCondition(key, QueryComparisons.Equal, dict[key].ToString()));
  388. builder.Append(" " + TableOperators.And + " " + typeStr);
  389. }
  390. index++;
  391. }
  392. else
  393. {
  394. throw new Exception("The parameter must have value!");
  395. }
  396. }
  397. exQuery.Where(builder.ToString());
  398. return await QueryList<T>(exQuery, table);
  399. }
  400. else
  401. {
  402. return null;
  403. }
  404. }
  405. private static async Task<List<T>> QueryList<T>(TableQuery<T> exQuery, CloudTable TableName ) where T : TableEntity, new()
  406. {
  407. TableContinuationToken continuationToken = null;
  408. List<T> entitys = new();
  409. do
  410. {
  411. var result = await TableName.ExecuteQuerySegmentedAsync(exQuery, continuationToken);
  412. if (result.Results.Count > 0)
  413. {
  414. entitys.AddRange(result.ToList());
  415. }
  416. continuationToken = result.ContinuationToken;
  417. } while (continuationToken != null);
  418. return entitys;
  419. }
  420. private static string SwitchType<T>(object obj, string key)
  421. {
  422. Type objType = typeof(T);
  423. PropertyInfo property = objType.GetProperty(key);
  424. //Type s = obj.GetType();
  425. //TypeCode typeCode = Type.GetTypeCode(s);
  426. if (property == null)
  427. {
  428. //return null;
  429. throw new Exception(objType.FullName + " PropertyInfo doesn't include this parameter :" + key);
  430. }
  431. TypeCode typeCode = Type.GetTypeCode(property.PropertyType);
  432. switch (typeCode)
  433. {
  434. case TypeCode.String: return TableQuery.GenerateFilterCondition(key, QueryComparisons.Equal, obj.ToString());
  435. case TypeCode.Int32: return TableQuery.GenerateFilterConditionForInt(key, QueryComparisons.Equal, int.Parse(obj.ToString()));
  436. case TypeCode.Double: return TableQuery.GenerateFilterConditionForDouble(key, QueryComparisons.Equal, (double)obj);
  437. case TypeCode.Byte: return TableQuery.GenerateFilterConditionForBinary(key, QueryComparisons.Equal, (byte[])obj);
  438. case TypeCode.Boolean: return TableQuery.GenerateFilterConditionForBool(key, QueryComparisons.Equal, (bool)obj);
  439. case TypeCode.DateTime: return TableQuery.GenerateFilterConditionForDate(key, QueryComparisons.Equal, (DateTimeOffset)obj);
  440. case TypeCode.Int64: return TableQuery.GenerateFilterConditionForLong(key, QueryComparisons.Equal, long.Parse(obj.ToString()));
  441. default: return null;
  442. }
  443. }
  444. /// <summary>
  445. /// 查询条件传string类型
  446. /// </summary>
  447. /// <typeparam name="T"></typeparam>
  448. /// <param name="azureStorage"></param>
  449. /// <param name="strWhere">查询条件| 例:$"RowKey {QueryComparisons.GreaterThanOrEqual} '{123456}' {TableOperators.And} RowKey {QueryComparisons.LessThanOrEqual} '{123456}'" </param>
  450. /// <returns></returns>
  451. public static async Task<List<T>> QueryWhereString<T>(this CloudTable table, string strWhere = null) where T : TableEntity, new()
  452. {
  453. var exQuery = new TableQuery<T>();
  454. exQuery.Where(strWhere);
  455. return await QueryList<T>(exQuery, table);
  456. }
  457. /// <summary>
  458. /// 删除单个记录
  459. /// </summary>
  460. /// <typeparam name="T"></typeparam>
  461. /// <param name="azureStorage"></param>
  462. /// <param name="partitionKey"></param>
  463. /// <param name="rowKey"></param>
  464. /// <returns></returns>
  465. public static async Task<TableResult> DeleteSingle<T>(this CloudTable table, string partitionKey, string rowKey) where T : ITableEntity, new()
  466. {
  467. // query all rows
  468. var queryOperation = TableOperation.Retrieve<T>(partitionKey, rowKey);
  469. var tableResult = await table.ExecuteAsync(queryOperation);
  470. if (tableResult.Result is T item)
  471. {
  472. var dels = await table.ExecuteAsync(TableOperation.Delete(item));
  473. return dels;
  474. }
  475. else return null;
  476. }
  477. /// <summary>
  478. /// 删除多个 带有后期优化该方法
  479. /// </summary>
  480. /// <typeparam name="T"></typeparam>
  481. /// <param name="azureStorage"></param>
  482. /// <param name="rowKey"></param>
  483. /// <returns></returns>
  484. public static async Task<List<string>> DeleteStringWhere<T>(this CloudTable table, string rowKey) where T : ITableEntity, new()
  485. {
  486. // query all rows
  487. var exQuery = new TableQuery<T>();
  488. exQuery.Where(rowKey);
  489. TableContinuationToken continuationToken = null;
  490. List<T> entitys = new();
  491. do
  492. {
  493. var result = await table.ExecuteQuerySegmentedAsync(exQuery, continuationToken);
  494. if (result.Results.Count > 0)
  495. {
  496. entitys.AddRange(result.ToList());
  497. }
  498. continuationToken = result.ContinuationToken;
  499. } while (continuationToken != null);
  500. List<string> ster = new List<string>();
  501. foreach (var item in entitys)
  502. {
  503. var tableResult = await table.ExecuteAsync(TableOperation.Retrieve<T>(item.PartitionKey, item.RowKey));
  504. if (tableResult.Result is T items)
  505. {
  506. var deleteOperation = TableOperation.Delete(items);
  507. await table.ExecuteAsync(deleteOperation);
  508. ster.Add(items.RowKey);
  509. }
  510. }
  511. return ster;
  512. }
  513. }
  514. }