BaseResponse.cs 869 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. namespace Znaf.Application.Communication
  2. {
  3. /// <summary>
  4. /// 响应基类
  5. /// </summary>
  6. /// <typeparam name="T"></typeparam>
  7. public abstract class BaseResponse<T>
  8. {
  9. /// <summary>
  10. /// 响应是否成功
  11. /// </summary>
  12. public bool Success { get; set; }
  13. /// <summary>
  14. /// 错误信息
  15. /// </summary>
  16. public string Message { get; set; }
  17. /// <summary>
  18. /// 响应数据源
  19. /// </summary>
  20. public T Resource { get; set; }
  21. protected BaseResponse(T resource)
  22. {
  23. Success = true;
  24. Message = string.Empty;
  25. Resource = resource;
  26. }
  27. protected BaseResponse(string message)
  28. {
  29. Success = false;
  30. Message = message;
  31. Resource = default;
  32. }
  33. }
  34. }