PropertyNoExistException.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Runtime.Serialization;
  3. namespace Masuit.Tools.Mapping.Exceptions
  4. {
  5. /// <summary>
  6. /// 找不到属性时出现异常
  7. /// </summary>
  8. [Serializable]
  9. public class PropertyNoExistException : MapperExceptionBase
  10. {
  11. /// <summary>
  12. /// 构造函数
  13. /// </summary>
  14. /// <param name="propertyName">属性名</param>
  15. /// <param name="typeObject">对象类型</param>
  16. public PropertyNoExistException(string propertyName, Type typeObject) : base(ValideParameter($"类型“{typeObject}”不存在属性“{propertyName}”", !String.IsNullOrEmpty(propertyName), typeObject != null))
  17. {
  18. }
  19. /// <summary>
  20. /// 构造函数
  21. /// </summary>
  22. public PropertyNoExistException()
  23. {
  24. }
  25. /// <summary>
  26. /// 构造函数
  27. /// </summary>
  28. /// <param name="exceptionMessage">异常信息</param>
  29. public PropertyNoExistException(string exceptionMessage) : base(exceptionMessage)
  30. {
  31. }
  32. /// <summary>
  33. /// 构造函数
  34. /// </summary>
  35. /// <param name="serializer">序列化信息</param>
  36. /// <param name="context">上下文</param>
  37. protected PropertyNoExistException(SerializationInfo serializer, StreamingContext context) : base(serializer, context)
  38. {
  39. }
  40. /// <summary>
  41. /// 构造函数
  42. /// </summary>
  43. /// <param name="exceptionMessage">异常信息</param>
  44. /// <param name="innerException">内部异常</param>
  45. public PropertyNoExistException(string exceptionMessage, Exception innerException) : base(exceptionMessage, innerException)
  46. {
  47. }
  48. }
  49. }