public ResultException(string message, ResultStatusType status = ResultStatusType.Faliure)
     : base(message)
 {
     if (status == ResultStatusType.Success)
     {
         throw new ArgumentOutOfRangeException("status error");
     }
 }
Beispiel #2
0
        public static TResult ToFailded <TResult>(this TResult result, Exception exception, ResultStatusType status = ResultStatusType.Faliure)
            where TResult : BaseResult
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            if (exception != null)
            {
                result.Message   = exception.Message;
                result.Exception = exception;
                result.Status    = status;
            }
            return(result);
        }
Beispiel #3
0
 /// <summary>
 /// 指定引发的异常和状态码,初始化一个 BaseResult 类的新实例。
 /// </summary>
 /// <param name="exception">引发的异常。如果为 null 值,将不会更改返回结果的状态。</param>
 /// <param name="status">结果的状态码。</param>
 public BaseResult(Exception exception, ResultStatusType status = ResultStatusType.Faliure)
 {
     this.ToFailded(exception, status);
 }
Beispiel #4
0
 /// <summary>
 /// 指定描述错误的信息和状态码,初始化一个 BaseResult 类的新实例。
 /// </summary>
 /// <param name="mssage">描述错误的信息。如果为 null 值,将不会更改返回结果的状态。</param>
 /// <param name="status">结果的状态码。</param>
 public BaseResult(string mssage, ResultStatusType status = ResultStatusType.Faliure)
 {
     this.ToFailded(mssage, status);
 }
Beispiel #5
0
 public BaseResult(string message, ResultStatusType status = ResultStatusType.Faliure)
     : base(message, status)
 {
 }
Beispiel #6
0
 public BaseResult(Exception exception, ResultStatusType status = ResultStatusType.Faliure)
     : base(exception, status)
 {
 }
 public ResultStatus(ResultStatusType type, string forProperty, string message)
     : this(forProperty, message)
 {
     Type = type;
 }
 public ResultStatus(ResultStatusType type)
 {
     Type = type;
 }
 public ResultStatus(ResultStatusType type, dynamic @object)
 {
     Object = @object;
     Type   = type;
 }