Skip to main content

DtoUtils

Assembly: ServiceStack.dll
View Source
Declaration
public static class DtoUtils

Fields

ResponseStatusPropertyName

Naming convention for the ResponseStatus property name on the response DTO

View Source
Declaration
public const string ResponseStatusPropertyName = "ResponseStatus"

Methods

CreateResponseStatus(Exception, Object, Boolean)

View Source
Declaration
public static ResponseStatus CreateResponseStatus(Exception ex, object request = null, bool debugMode = false)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
System.Exceptionex
System.Objectrequest
System.BooleandebugMode

ToResponseStatus(Exception, Object)

View Source
Declaration
public static ResponseStatus ToResponseStatus(this Exception exception, object requestDto = null)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
System.Exceptionexception
System.ObjectrequestDto

ToResponseStatus(ValidationError)

View Source
Declaration
public static ResponseStatus ToResponseStatus(this ValidationError validationException)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
ServiceStack.Validation.ValidationErrorvalidationException

ToResponseStatus(ValidationErrorResult)

View Source
Declaration
public static ResponseStatus ToResponseStatus(this ValidationErrorResult validationResult)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
ServiceStack.Validation.ValidationErrorResultvalidationResult

CreateSuccessResponse(String)

View Source
Declaration
public static ResponseStatus CreateSuccessResponse(string message)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
System.Stringmessage

CreateResponseStatus(String)

View Source
Declaration
public static ResponseStatus CreateResponseStatus(string errorCode)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
System.StringerrorCode

CreateResponseStatus(String, String)

View Source
Declaration
public static ResponseStatus CreateResponseStatus(string errorCode, string errorMessage)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
System.StringerrorCode
System.StringerrorMessage

CreateErrorResponse(String, String, IEnumerable<ValidationErrorField>)

View Source
Declaration
public static object CreateErrorResponse(string errorCode, string errorMessage, IEnumerable<ValidationErrorField> validationErrors)
Returns

System.Object

Parameters
TypeName
System.StringerrorCode
System.StringerrorMessage
System.Collections.Generic.IEnumerable<ServiceStack.Validation.ValidationErrorField>validationErrors

CreateErrorResponse(Object, ValidationErrorResult)

View Source
Declaration
public static object CreateErrorResponse(object request, ValidationErrorResult validationError)
Returns

System.Object

Parameters
TypeName
System.Objectrequest
ServiceStack.Validation.ValidationErrorResultvalidationError

CreateErrorResponse(Object, Exception, ResponseStatus)

View Source
Declaration
public static object CreateErrorResponse(object request, Exception ex, ResponseStatus responseStatus)
Returns

System.Object

Parameters
TypeName
System.Objectrequest
System.Exceptionex
ServiceStack.ResponseStatusresponseStatus

CreateResponseDto(Object, ResponseStatus)

Create an instance of the service response dto type and inject it with the supplied responseStatus

View Source
Declaration
public static object CreateResponseDto(object request, ResponseStatus responseStatus)
Returns

System.Object

Parameters
TypeName
System.Objectrequest
ServiceStack.ResponseStatusresponseStatus

CreateErrorResponse(Object, Exception)

Create an Error Response DTO for the specified Request DTO from the Exception

View Source
Declaration
public static object CreateErrorResponse(object request, Exception ex)
Returns

System.Object

Parameters
TypeName
System.Objectrequest
System.Exceptionex