PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/BlogEngine/DotNetSlave.BusinessLogic/Compilation/SessionExpressionBuilder.cs

#
C# | 68 lines | 31 code | 10 blank | 27 comment | 0 complexity | 0a7dc6258e578c667158b9c26a6a7afe MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <summary>
  3. // Session Expression Builder
  4. // </summary>
  5. // --------------------------------------------------------------------------------------------------------------------
  6. namespace BlogEngine.Core.Compilation
  7. {
  8. using System.Web;
  9. using System.Web.Compilation;
  10. /// <summary>
  11. /// Session Expression Builder
  12. /// </summary>
  13. [ExpressionPrefix("Session")]
  14. [ExpressionEditor("BlogEngine.Core.Compilation.Design.SessionExpressionEditor, BlogEngine.Core")]
  15. public class SessionExpressionBuilder : BaseServerObjectExpressionBuilder
  16. {
  17. #region Properties
  18. /// <summary>
  19. /// Gets the name of the source object.
  20. /// </summary>
  21. /// <value>The name of the source object.</value>
  22. public override string SourceObjectName
  23. {
  24. get
  25. {
  26. return "Session";
  27. }
  28. }
  29. #endregion
  30. #region Public Methods
  31. /// <summary>
  32. /// Creates a new instance of this expression builder.
  33. /// </summary>
  34. /// <returns>
  35. /// A new instance of this expression builder.
  36. /// </returns>
  37. public static SessionExpressionBuilder Instance()
  38. {
  39. return new SessionExpressionBuilder();
  40. }
  41. #endregion
  42. #region Methods
  43. /// <summary>
  44. /// Gets the value.
  45. /// </summary>
  46. /// <param name="key">
  47. /// The key of the value to get.
  48. /// </param>
  49. /// <returns>
  50. /// The value.
  51. /// </returns>
  52. protected override object GetValue(string key)
  53. {
  54. return HttpContext.Current.Session[key];
  55. }
  56. #endregion
  57. }
  58. }