Class ApiResponse<TData, TStatusCode>
Defines the standard response for all services.
Inheritance
System.Object
ApiResponse<TData, TStatusCode>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Celerik.NetCore.Services
Assembly: cs.temp.dll.dll
Syntax
public class ApiResponse<TData, TStatusCode>
where TData : class where TStatusCode : struct, IConvertible
Type Parameters
| Name | Description |
|---|---|
| TData | Type of the Data property. |
| TStatusCode | Type of the StatusCode poperty. |
Properties
Data
Data sent in the response.
Declaration
public TData Data { get; set; }
Property Value
| Type | Description |
|---|---|
| TData |
Message
An optional localized message describing the execution of the service.
Declaration
public string Message { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
MessageType
Describes the type of message, null if there is no message.
Declaration
public ApiMessageType? MessageType { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<ApiMessageType> |
StatusCode
The status code related to service execution (enumeration).
Declaration
public TStatusCode StatusCode { get; set; }
Property Value
| Type | Description |
|---|---|
| TStatusCode |
Success
Indicates whether the service ran successfully.
Declaration
public bool Success { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
ToString()
Returns a JSON string that represents the current object.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | JSON string that represents the current object. |
Overrides
System.Object.ToString()
Operators
Implicit(ApiError<TStatusCode> to ApiResponse<TData, TStatusCode>)
Converts an ApiError<TStatusCode> into an ApiResponse<TData, TStatusCode>.
Declaration
public static implicit operator ApiResponse<TData, TStatusCode>(ApiError<TStatusCode> error)
Parameters
| Type | Name | Description |
|---|---|---|
| ApiError<TStatusCode> | error | The object to cast. |
Returns
| Type | Description |
|---|---|
| ApiResponse<TData, TStatusCode> |