Class ResponseUtils
Provides utility methods for working with BaseResponse in context of WCF service.
Inheritance
Inherited Members
Namespace: Terrasoft.Core.ServiceModelContract
Assembly: Terrasoft.Core.ServiceModelContract.dll
Syntax
public static class ResponseUtils
Methods
CreateResponseWithErrorInfo(Exception)
Creates instance of BaseResponse containing specified error information.
Declaration
public static BaseResponse CreateResponseWithErrorInfo(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exception | The exception. |
Returns
Type | Description |
---|---|
BaseResponse |
CreateResponseWithErrorInfo<TResponse>(Exception)
Creates response instance containing specified error information.
Declaration
public static TResponse CreateResponseWithErrorInfo<TResponse>(Exception exception)
where TResponse : BaseResponse, new()
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exception | The exception instance. |
Returns
Type | Description |
---|---|
TResponse |
Type Parameters
Name | Description |
---|---|
TResponse | The type of the response. |
SetDesingTimeException<TResponse>(TResponse, Exception)
Initializes response instance with desing time exception and sets response status code to 500.
Declaration
public static void SetDesingTimeException<TResponse>(this TResponse source, Exception exception)
where TResponse : BaseResponse
Parameters
Type | Name | Description |
---|---|---|
TResponse | source | The response instance. |
System.Exception | exception | The exception. |
Type Parameters
Name | Description |
---|---|
TResponse | The type of the response. |
Remarks
This method adds call stack data to source
only when assembly is compiled in
debug mode.
SetErrorInfo<TResponse>(TResponse, Exception)
Initializes response instance with specified error information.
Declaration
public static void SetErrorInfo<TResponse>(this TResponse source, Exception exception)
where TResponse : BaseResponse
Parameters
Type | Name | Description |
---|---|---|
TResponse | source | The source. |
System.Exception | exception | The exception. |
Type Parameters
Name | Description |
---|---|
TResponse | The type of the response. |
SetRunTimeException<TResponse>(TResponse, Exception)
Initializes response instance with run time exception and sets response status code to 500.
Declaration
public static void SetRunTimeException<TResponse>(this TResponse source, Exception exception)
where TResponse : BaseResponse
Parameters
Type | Name | Description |
---|---|---|
TResponse | source | The source. |
System.Exception | exception | The exception. |
Type Parameters
Name | Description |
---|---|
TResponse | The type of the response. |