AppConsts.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using ZhonTai.Tools.DynamicApi.Helpers;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Reflection;
  5. namespace ZhonTai.Tools.DynamicApi
  6. {
  7. public static class AppConsts
  8. {
  9. public static string DefaultHttpVerb { get; set; }
  10. public static string DefaultAreaName { get; set; }
  11. public static string DefaultApiPreFix { get; set; }
  12. public static List<string> ControllerPostfixes { get; set; }
  13. public static List<string> ActionPostfixes { get; set; }
  14. public static List<Type> FormBodyBindingIgnoredTypes { get; set; }
  15. public static Dictionary<string,string> HttpVerbs { get; set; }
  16. public static bool PascalToKebabCase { get; set; } = true;
  17. public static Func<string, string> GetRestFulControllerName { get; set; }
  18. public static Func<string, string> GetRestFulActionName { get; set; }
  19. public static Dictionary<Assembly, AssemblyDynamicApiOptions> AssemblyDynamicApiOptions { get; set; }
  20. static AppConsts()
  21. {
  22. HttpVerbs=new Dictionary<string, string>()
  23. {
  24. ["add"] = "POST",
  25. ["create"] = "POST",
  26. ["insert"] = "POST",
  27. ["submit"] = "POST",
  28. ["post"] = "POST",
  29. ["get"] = "GET",
  30. ["find"] = "GET",
  31. ["fetch"] = "GET",
  32. ["query"] = "GET",
  33. ["update"] = "PUT",
  34. ["change"] = "PUT",
  35. ["put"] = "PUT",
  36. ["delete"] = "DELETE",
  37. ["softdelete"] = "DELETE",
  38. ["remove"] = "DELETE",
  39. ["clear"] = "DELETE",
  40. };
  41. }
  42. }
  43. }