BaseService.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Threading.Tasks;
  5. using Microsoft.WindowsAzure.Storage.Table;
  6. using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
  7. using TEAMModelOS.SDK.Module.AzureCosmosDB.Implements;
  8. using TEAMModelOS.SDK.Module.AzureTable.Implements;
  9. using TEAMModelOS.Service.Core.Interfaces;
  10. namespace TEAMModelOS.Service.Core.Implements
  11. {
  12. public class BaseService : AzureTableDBRepository , IBaseService
  13. {
  14. public async Task<List<T>> FindListByDictHasAll<T>(Dictionary<string, object> dict) where T : TableEntity, new()
  15. {
  16. if (dict.Count <= 0)
  17. {
  18. return await FindAll<T>();
  19. }
  20. else
  21. {
  22. return await FindListByDict<T>(dict);
  23. }
  24. }
  25. public async Task<int> DeleteAll<T>(Dictionary<string, object> dict) where T : TableEntity, new()
  26. {
  27. List<T> list = await FindListByDict<T>(dict);
  28. if (list.IsNotEmpty())
  29. {
  30. list = await DeleteAll<T>(list);
  31. return list.Count;
  32. }
  33. else {
  34. return 0;
  35. }
  36. }
  37. }
  38. }