Exemplo n.º 1
0
 /// <summary>
 /// Create statemiddleware
 /// </summary>
 /// <param name="name">name of the kind of state</param>
 /// <param name="storage">storage provider to use</param>
 /// <param name="settings">settings</param>
 public BotState(IStorage storage, string propertyName, Func <IBotContext, 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();
 }
Exemplo n.º 2
0
 public UserState(IStorage storage, StateSettings settings = null) :
     base(storage,
          PropertyName,
          (context) => $"user/{context.ConversationReference.ChannelId}/{context.ConversationReference.User.Id}")
 {
 }
Exemplo n.º 3
0
 public ConversationState(IStorage storage, StateSettings settings = null) :
     base(storage, PropertyName,
          (context) => $"conversation/{context.ConversationReference.ChannelId}/{context.ConversationReference.Conversation.Id}",
          settings)
 {
 }