Skip to content

ContextCookieHelperService

Implementation of IContextCookieHelper that edits the userSettings dictionary of a ContextCookie in memory.

Purpose

  • Maintain user settings inside the cookie payload.

Context

  • Namespace: BolMiddleware.ContextCookieHelper
  • Assembly/package: BolMiddleware

Public members

Member Signature Purpose
AddUserSetting void AddUserSetting(string key, string value, ContextCookie cookie) Inserts or overwrites the entry in userSettings.
RemoveUserSetting void RemoveUserSetting(string key, ContextCookie cookie) Deletes the entry.
GetUserSetting bool GetUserSetting(string key, ContextCookie cookie, out string value) Returns the value through the out parameter and whether it was found.
DoesUserSettingExist bool DoesUserSettingExist(string key, ContextCookie cookie) Checks the dictionary for the key.

Behavioral notes

  • A null key throws ArgumentNullException.
  • Registered as singleton and holds no state itself.

Constraints and usage notes

  • Changes live only in the passed cookie object until it is saved.

Sources

  • src/BolMiddleware/ContextCookieHelper/ContextCookieHelper.cs