1
0

AppConsts.cs 1.6 KB

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