Example #1
0
        public static T Read <T>(IDialogContext context) where T : new()
        {
            var data = BotStateHelper <T> .GetUserData(context);

            if (data == null)
            {
                data = new T();
            }
            return(data);
        }
Example #2
0
        public static T Read <T>(IActivity activity) where T : new()
        {
            T data = default(T);

            data = BotStateHelper <T> .GetUserData(activity);

            if (data == null)
            {
                data = new T();
            }
            return(data);
        }
Example #3
0
 public static void Save <T>(IDialogContext context, T data)
 {
     BotStateHelper <T> .SetUserData(context, data);
 }