/// <summary> /// Creates a new <see cref="UserState{TState}"/> object. /// </summary> /// <param name="storage">The storage provider to use.</param> /// <param name="settings">The state persistance options to use.</param> public UserState(IStorage storage, StateSettings settings = null) : base(storage, PropertyName, (context) => $"user/{context.Activity.ChannelId}/{context.Activity.From.Id}", settings) { }
/// <summary> /// Creates a new <see cref="BotState{TState}"/> middleware object. /// </summary> /// <param name="name">The name to use to load or save the state object.</param> /// <param name="storage">The storage provider to use.</param> /// <param name="settings">The state persistance options to use.</param> public BotState(IStorage storage, string propertyName, Func <ITurnContext, string> keyDelegate, StateSettings settings = null) { _storage = storage ?? throw new ArgumentNullException(nameof(storage)); _propertyName = propertyName ?? throw new ArgumentNullException(nameof(propertyName)); _keyDelegate = keyDelegate ?? throw new ArgumentNullException(nameof(keyDelegate)); _settings = settings ?? new StateSettings(); }
/// <summary> /// Creates a new <see cref="ConversationState{TState}"/> object. /// </summary> /// <param name="storage">The storage provider to use.</param> /// <param name="settings">The state persistance options to use.</param> public ConversationState(IStorage storage, StateSettings settings = null) : base(storage, PropertyName, (context) => $"conversation/{context.Activity.ChannelId}/{context.Activity.Conversation.Id}", settings) { }