MapperExistException.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 MapperExistException : MapperExceptionBase
  10. {
  11. /// <summary>
  12. /// 构造函数
  13. /// </summary>
  14. /// <param name="source">源类型</param>
  15. /// <param name="dest">目标类型</param>
  16. public MapperExistException(Type source, Type dest) : base(ValideParameter($"对于源“{source.FullName}”的类型和目标类型“{dest.FullName}”的映射关系已经存在", source != null, dest != null))
  17. {
  18. }
  19. /// <summary>
  20. /// 构造函数
  21. /// </summary>
  22. public MapperExistException()
  23. {
  24. }
  25. /// <summary>
  26. /// 构造函数
  27. /// </summary>
  28. /// <param name="exceptionMessage">异常信息</param>
  29. public MapperExistException(string exceptionMessage) : base(exceptionMessage)
  30. {
  31. }
  32. /// <summary>
  33. /// 构造函数
  34. /// </summary>
  35. /// <param name="serializer">序列化信息</param>
  36. /// <param name="context">上下文</param>
  37. protected MapperExistException(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 MapperExistException(string exceptionMessage, Exception innerException) : base(exceptionMessage, innerException)
  46. {
  47. }
  48. }
  49. }