private static BotStateConfigurationBuilder UseBotState <TBotState>(BotStateConfigurationBuilder builder, Action <BotStateBuilder <TBotState> > configure)
            where TBotState : BotState
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var stateBuilder = new BotStateBuilder <TBotState>(builder);

            configure(stateBuilder);

            var botState = stateBuilder.Build();

            return(builder.UseBotState(botState));
        }
Ejemplo n.º 2
0
 internal BotStateBuilder(BotStateConfigurationBuilder botStateConfigurationBuilder)
 {
     _botStateConfigurationBuilder = botStateConfigurationBuilder ?? throw new ArgumentNullException(nameof(botStateConfigurationBuilder));
     _storage    = null;
     _properties = new Dictionary <string, Type>();
 }
 public static BotStateConfigurationBuilder UseUserState(this BotStateConfigurationBuilder builder, Action <BotStateBuilder <UserState> > configure) =>
 UseBotState <UserState>(builder, configure);