您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LuController.cs 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections.Generic;
  2. using System.Threading;
  3. using Luticate2.Utils.Dbo;
  4. using Luticate2.Utils.Dbo.Basic;
  5. using Luticate2.Utils.Dbo.Result;
  6. using Microsoft.AspNetCore.Mvc;
  7. using Microsoft.AspNetCore.SignalR.Infrastructure;
  8. namespace Luticate2.Utils.Controllers
  9. {
  10. public abstract class LuController : Controller
  11. {
  12. protected IConnectionManager ConnectionManager { get; set; }
  13. protected IDictionary<object, object> LuItems => HttpContext.GetLuItems();
  14. protected LuApiWrapperDbo<T> Handle<T>(LuResult<T> result)
  15. {
  16. if (result)
  17. {
  18. return new LuApiWrapperDbo<T>
  19. {
  20. code = 200,
  21. data = result.Data,
  22. message = null
  23. };
  24. }
  25. throw new LuResultException(result.To<object>());
  26. }
  27. protected LuApiWrapperDbo<LuBoxedValueDbo<T>> HandleBoxed<T>(LuResult<T> result)
  28. {
  29. return Handle(result.To(arg => new LuBoxedValueDbo<T>
  30. {
  31. Value = arg
  32. }));
  33. }
  34. }
  35. }