Пример #1
0
 public static ResultWebApi <T> ToResultWebApi <T>(this ResultBasic <T> resultBasic)
 {
     if (resultBasic.IsSuccess)
     {
         return(resultBasic.Data.Success(resultBasic.Msg));
     }
     else if (resultBasic.ExInfo == null)
     {
         return(resultBasic.Data.Fail(resultBasic.Msg));
     }
     else
     {
         return(resultBasic.Data.Exception(resultBasic.ExInfo));
     }
 }
Пример #2
0
        public static ResultMicServ <T> ToResultMicServ <T>(this ResultBasic <T> resultBasic)
        {
            ResultMicServ <T> result;

            result           = new ResultMicServ <T>();
            result.IsSuccess = resultBasic.IsSuccess;
            result.Code      = Enum_StateCode.Success.ToIntString();
            result.Msg       = resultBasic.Msg;
            result.Data      = resultBasic.Data;

            if (resultBasic.ExInfo != null)
            {
                Exception_Basic cusEx = resultBasic.ExInfo as Exception_Basic;
                result.Code = cusEx != null?cusEx.ECode.ToIntString() : Enum_StateCode.SysError.ToIntString();

                result.Msg              = resultBasic.ExInfo.Message;
                result.ErrorStackTrace += "\r\n" + resultBasic.ExInfo.StackTrace;
            }

            return(result);
        }
Пример #3
0
 public static UnaryResult <ResultMicServ <T> > ToMicServResult <T>(this ResultBasic <T> resultBasic)
 {
     return(new UnaryResult <ResultMicServ <T> >(resultBasic.ToResultMicServ()));
 }