AzureCosmosExtensions.cs 714 B

123456789101112131415161718192021222324252627282930
  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 Azure;
  11. namespace TEAMModelOS.SDK.DI
  12. {
  13. public static class AzureCosmosExtensions
  14. {
  15. public static int RU(this Response response)
  16. {
  17. try
  18. {
  19. response.Headers.TryGetValue("x-ms-request-charge", out var value);
  20. var ru = Convert.ToInt32(value);
  21. return ru;
  22. }
  23. catch (Exception)
  24. {
  25. return 0;
  26. }
  27. }
  28. }
  29. }