예제 #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);
        }
예제 #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);
        }
예제 #3
0
 public static void Save <T>(IDialogContext context, T data)
 {
     BotStateHelper <T> .SetUserData(context, data);
 }