public XResult <TOther> Copy <TOther>(TOther obj = default(TOther), [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0 ) { var o = new XResult <TOther>(obj, Message, ResultCode); if (o.CallerInfoHistory == null) { o.CallerInfoHistory = new List <OperationCallerInfo>(); } o.CallerInfoHistory.Add(CallerInfo); if (CallerInfoHistory != null) { foreach (var item in CallerInfoHistory) { o.CallerInfoHistory.Add(item); } } o._setCallerInformation(memberName, sourceFilePath, sourceLineNumber); return(o); }
public static XResult <T> GetSuccess(T obj, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) { var o = new XResult <T>(obj); o._setCallerInformation(memberName, sourceFilePath, sourceLineNumber); return(o); }
public static XResult <T> GetNoRecord(string message = null, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) { var o = new XResult <T>(default(T), string.Format("No record found that matches your request", message), OperationResults.NoRecord); o._setCallerInformation(memberName, sourceFilePath, sourceLineNumber); return(o); }
public static XResult <T> GetNoData(string message = null, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) { var o = new XResult <T>(default(T), string.Format("No data returned - possible network issue {0}", message), OperationResults.NoData); o._setCallerInformation(memberName, sourceFilePath, sourceLineNumber); return(o); }
public static XResult <T> GetDatabaseProblem(string message = null, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) { var o = new XResult <T>(default(T), string.Format("Database problem {0}", message), OperationResults.Failed); o._setCallerInformation(memberName, sourceFilePath, sourceLineNumber); return(o); }
public static XResult <T> GetFailed(string message = null, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0 ) { var o = new XResult <T>(default(T), message ?? "Something went wrong and I could not complete that", OperationResults.Failed); o._setCallerInformation(memberName, sourceFilePath, sourceLineNumber); return(o); }
public static XResult <T> GetBadRequest(string message = null, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0 ) { var o = new XResult <T>(default(T), message ?? "It doesn't work like that (bad request)", OperationResults.BadRequest); o._setCallerInformation(memberName, sourceFilePath, sourceLineNumber); return(o); }
public static XResult <T> GetNotAuthorised(string message = null, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0 ) { var o = new XResult <T>(default(T), message ?? "Not authorised to do that", OperationResults.NotAuthorised); o._setCallerInformation(memberName, sourceFilePath, sourceLineNumber); return(o); }
public static XResult <T> GetException(string message = null, Exception ex = null, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0 ) { var messageFormatted = string.Format("Message: {0}, Exception: {1}", message, ex); var o = new XResult <T>(default(T), messageFormatted, OperationResults.Exception); o.Exception = ex; o._setCallerInformation(memberName, sourceFilePath, sourceLineNumber); return(o); }