ErrorMessage.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System.Collections.Generic;
  2. namespace SqlSugar.BzTDengineCore
  3. {
  4. internal static partial class ErrorMessage
  5. {
  6. internal static LanguageType SugarLanguageType { get; set; } = LanguageType.Default;
  7. internal static string ObjNotExist
  8. {
  9. get
  10. {
  11. return GetThrowMessage("{0} does not exist.",
  12. "{0}不存在。");
  13. }
  14. }
  15. internal static string EntityMappingError
  16. {
  17. get
  18. {
  19. return GetThrowMessage("Entity mapping error.{0}",
  20. "实体与表映射出错。{0}");
  21. }
  22. }
  23. public static string NotSupportedDictionary
  24. {
  25. get
  26. {
  27. return GetThrowMessage("This type of Dictionary is not supported for the time being. You can try Dictionary<string, string>, or contact the author!!",
  28. "暂时不支持该类型的Dictionary 你可以试试 Dictionary<string ,string>或者联系作者!!");
  29. }
  30. }
  31. public static string NotSupportedArray
  32. {
  33. get
  34. {
  35. return GetThrowMessage("This type of Array is not supported for the time being. You can try object[] or contact the author!!",
  36. "暂时不支持该类型的Array 你可以试试 object[] 或者联系作者!!");
  37. }
  38. }
  39. internal static string GetThrowMessage(string enMessage, string cnMessage, params string[] args)
  40. {
  41. if (SugarLanguageType == LanguageType.Default)
  42. {
  43. List<string> formatArgs = new List<string>() { enMessage, cnMessage };
  44. formatArgs.AddRange(args);
  45. return string.Format(@"中文提示 : {1}
  46. English Message : {0}", formatArgs.ToArray());
  47. }
  48. else if (SugarLanguageType == LanguageType.English)
  49. {
  50. return enMessage;
  51. }
  52. else
  53. {
  54. return cnMessage;
  55. }
  56. }
  57. }
  58. }