Beispiel #1
0
 private Result(TReturn returnValue, Type returnType)
 {
     ReturnValue = returnValue;
     if (ReturnValue == null)
     {
         _failureInfo = new ResultFailure(returnType);
     }
     IsSuccess = (ReturnValue != null);
 }
Beispiel #2
0
 public void AddFailure(int code, string message = null)
 {
     IsSuccess = false;
     if (_failureInfo == null)
     {
         _failureInfo = new ResultFailure(typeof(TReturn), code, message);
     }
     else
     {
         _failureInfo.Errors.Add(new ResultFailure.Error(code, message));
     }
 }
Beispiel #3
0
 private Result()
 {
     ReturnValue  = default(TReturn);
     _failureInfo = new ResultFailure(typeof(TReturn));
     IsSuccess    = false;
 }
Beispiel #4
0
 private Result(ResultFailure failureInfo, object instance)
 {
     _failureInfo        = failureInfo;
     _failureInfo.Object = instance;
     IsSuccess           = false;
 }
Beispiel #5
0
 private Result(ResultFailure failureInfo)
 {
     _failureInfo = failureInfo;
     IsSuccess    = false;
 }
Beispiel #6
0
 public static Result <TReturn> Failed(ResultFailure failureInfo, object instance)
 {
     return(new Result <TReturn>(failureInfo, instance));
 }
Beispiel #7
0
 public static Result <TReturn> Failed(ResultFailure failureInfo)
 {
     return(new Result <TReturn>(failureInfo));
 }
 public ResultException(ResultFailure failureInfo)
 {
     FailureInfo = failureInfo;
 }