Exemple #1
0
        /// <summary>
        /// 默认初始化一个失败的返回值,并写入 info
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="info"></param>
        /// <returns></returns>
        public static DataShell <T> CreateFail <T>(string info)
        {
            var t = new DataShell <T>();

            t.Failed(info);
            return(t);
        }
        /// <summary>
        /// 默认初始化一个失败的返回值,并写入 info
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="info"></param>
        /// <returns></returns>
        public static DataShell <T> CreateFail <T>(IList <string> infos)
        {
            var t = new DataShell <T>();

            t.Failed(infos);
            return(t);
        }
        /// <summary>
        /// 默认初始化一个失败的返回值
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static DataShell <T> CreateFail <T>()
        {
            var t = new DataShell <T>();

            t.Failed();
            return(t);
        }
        /// <summary>
        /// 默认初始化一个失败的数据壳,写入exception
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="exception"></param>
        /// <returns></returns>
        public static DataShell <T> CreateFail <T>(Exception exception)
        {
            var t = new DataShell <T>();

            t.Failed(exception.Message);
            t.AddInfoDetail(exception.StackTrace);
            //t.ExceptionList.Add(exception);
            return(t);
        }