You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.5 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. namespace Apewer.Web
  4. {
  5. /// <summary></summary>
  6. public abstract class ApiController : IDisposable
  7. {
  8. private ApiRequest _request = null;
  9. private ApiResponse _response = null;
  10. private bool _allow = true;
  11. /// <summary></summary>
  12. public virtual ApiRequest Request
  13. {
  14. get { return _request; }
  15. internal set { _request = value; }
  16. }
  17. /// <summary></summary>
  18. public virtual ApiResponse Response
  19. {
  20. get
  21. {
  22. if (_response == null) _response = new ApiResponse();
  23. return _response;
  24. }
  25. internal set { _response = value; }
  26. }
  27. /// <summary></summary>
  28. public virtual Action AfterInitialized { get; set; }
  29. /// <summary>默认允许调用 Function。当存在 Independent 特性时 Invoker 将忽略此值,且不调用 Function。</summary>
  30. public virtual bool AllowFunction
  31. {
  32. get { return _allow; }
  33. protected set { _allow = value; }
  34. }
  35. #if NETFX
  36. /// <summary>System.Web.HttpContext</summary>
  37. public virtual System.Web.HttpContext Context { get; internal set; }
  38. #endif
  39. #if NETCORE
  40. /// <summary>Microsoft.AspNetCore.Http.HttpContext</summary>
  41. public virtual Microsoft.AspNetCore.Http.HttpContext Context { get; internal set; }
  42. #endif
  43. /// <summary></summary>
  44. public virtual void Dispose() { }
  45. }
  46. }