Class HttpPacketResult
Represents a JSON result packet returned by controller action methods.
public class HttpPacketResult
- Inheritance
-
HttpPacketResult
- Inherited Members
- Extension Methods
Constructors
HttpPacketResult()
Constructor.
public HttpPacketResult()
Properties
Entity
Gets or sets an entity serialized along with this result as a whole.
public object Entity { get; set; }
Property Value
ErrorText
Gets or sets the error information, if any.
public string ErrorText { get; set; }
Property Value
IsSuccess
Gets or sets a value indicating whether the call succeeded business-logic-wise.
public bool IsSuccess { get; set; }
Property Value
Packet
Gets or sets the JSON text packet returned to the caller.
public string Packet { get; set; }
Property Value
Methods
DeserializePacket<T>()
Deserializes the Packet property to an instance of a specified type.
public T DeserializePacket<T>()
Returns
- T
Type Parameters
T
Error(string)
Creates and returns a failed result with an error message.
public static HttpPacketResult Error(string ErrorText)
Parameters
ErrorTextstring
Returns
SerializePacket(object)
Serializes a specified instance and assigns the Packet property.
public void SerializePacket(object Packet)
Parameters
Packetobject
SetEntity(object, bool)
Creates and returns a result with an entity serialized as part of the result object.
public static HttpPacketResult SetEntity(object Entity, bool IsSuccess = true)
Parameters
Returns
SetPacket(object, bool)
Creates and returns a successful result with a serialized packet.
public static HttpPacketResult SetPacket(object Packet, bool IsSuccess = true)