Class ResultResponseMessage<TResponseMessage>
Class with the default and consolidated result of the request.
Responsible for encapsulating validations and responses with specific methods that aid in the handling of messages.
Implements
IActionResult
Inherited Members
Namespace: StoneCo.Framework.Services
Assembly: cs.temp.dll.dll
Syntax
[Serializable]
public class ResultResponseMessage<TResponseMessage> : ResultResponseMessage, IActionResult where TResponseMessage : ResponseMessage
Type Parameters
Name | Description |
---|---|
TResponseMessage | The type of the response to be returned in the result. |
Constructors
ResultResponseMessage()
Default constructor.
warning
This constructor is only for the internal use of the framework.
Declaration
public ResultResponseMessage()
ResultResponseMessage(RequestMessage)
Mandatory constructor that set
note
Request information is required to configure the response. Always use this constructor by default.
Declaration
public ResultResponseMessage(RequestMessage requestMessage)
Parameters
Type | Name | Description |
---|---|---|
RequestMessage | requestMessage | Request that will be referenced in the response. |
Examples
Bar class used in this example.
public class Bar
{
[HttpPost("new")]
public IActionResult CreateNew(RequestMessage request)
{
var response = new ResponseMessage();
return new ResultResponseMessage<ResponseMessage>(request);
}
}
Properties
Return
Return of the request.
Declaration
public TResponseMessage Return { get; }
Property Value
Type | Description |
---|---|
TResponseMessage | Response or null. |
Methods
SetReturn(TResponseMessage)
Set object response of the type TResponseMessage.
Declaration
public void SetReturn(TResponseMessage responseMessage)
Parameters
Type | Name | Description |
---|---|---|
TResponseMessage | responseMessage | Instance of the response. |
Examples
Bar class used in this example.
public class Bar
{
[HttpPost("new")]
public IActionResult CreateNew(RequestMessage request)
{
var response = new ResponseMessage();
var result = new ResultResponseMessage<ResponseMessage>(request);
result.SetReturn(response);
return result;
}
}
Implements
IActionResult