LogAttribute.cs 1000 B

1234567891011121314151617181920212223242526272829303132333435
  1. using Enums;
  2. namespace Attribute
  3. {
  4. /// <summary>
  5. /// 自定义操作日志记录注解
  6. /// </summary>
  7. public class LogAttribute : System.Attribute
  8. {
  9. public string Title { get; set; }
  10. public BusinessType BusinessType { get; set; }
  11. /// <summary>
  12. /// 是否保存请求数据
  13. /// </summary>
  14. public bool IsSaveRequestData { get; set; } = true;
  15. /// <summary>
  16. /// 是否保存返回数据
  17. /// </summary>
  18. public bool IsSaveResponseData { get; set; } = true;
  19. public LogAttribute() { }
  20. public LogAttribute(string name)
  21. {
  22. Title = name;
  23. }
  24. public LogAttribute(string name, BusinessType businessType, bool saveRequestData = true, bool saveResponseData = true)
  25. {
  26. Title = name;
  27. BusinessType = businessType;
  28. IsSaveRequestData = saveRequestData;
  29. IsSaveResponseData = saveResponseData;
  30. }
  31. }
  32. }