Photon Server API
Public Member Functions | Properties | List of all members
Photon.SocketServer.OperationResponse Class Reference

Incoming OperationRequests are often answered with a response (represented by this class). It can be sent to the client by using the PeerBase.SendOperationResponse method. The IRpcProtocol.SerializeOperationResponse method serializes OperationResponse instances. SetParameters(object) converts properties that are flagged with DataMemberAttribute into the Parameters dictionary. More...

Public Member Functions

 OperationResponse ()
 Initializes a new instance of the OperationResponse class. More...
 
 OperationResponse (byte operationCode)
 Initializes a new instance of the OperationResponse class. This constructor sets the OperationCode. More...
 
 OperationResponse (byte operationCode, object dataContract)
 Initializes a new instance of the OperationResponse class. This constructor calls SetParameters(object) and sets the OperationCode. More...
 
 OperationResponse (byte operationCode, Dictionary< byte, object > parameters)
 Initializes a new instance of the OperationResponse class. This constructor sets the Parameters and the OperationCode. More...
 
void SetParameters (object dataContract)
 Converts properties of an object to response Parameters. Included properties require the DataMemberAttribute. More...
 
void SetParameters (Dictionary< byte, object > parameters)
 Replaces the Parameters with parameters . More...
 

Properties

string DebugMessage [get, set]
 Gets or sets the debug message. Error code 0 returns typically debug message "Ok". More...
 
byte OperationCode [get, set]
 Gets or sets the operation code. It allows the client to idenitfy which operation was answered. More...
 
Dictionary< byte, object > Parameters [get, set]
 Gets or sets the response parameters. More...
 
object this[byte parameterKey] [get, set]
 Gets or sets the paramter associated with the specified key. More...
 
short ReturnCode [get, set]
 Gets or sets the error code. Code 0 means OK. More...
 

Detailed Description

Incoming OperationRequests are often answered with a response (represented by this class). It can be sent to the client by using the PeerBase.SendOperationResponse method. The IRpcProtocol.SerializeOperationResponse method serializes OperationResponse instances. SetParameters(object) converts properties that are flagged with DataMemberAttribute into the Parameters dictionary.

Constructor & Destructor Documentation

Photon.SocketServer.OperationResponse.OperationResponse ( )
inline

Initializes a new instance of the OperationResponse class.

Photon.SocketServer.OperationResponse.OperationResponse ( byte  operationCode)
inline

Initializes a new instance of the OperationResponse class. This constructor sets the OperationCode.

Parameters
operationCodeDetermines the OperationCode.
Photon.SocketServer.OperationResponse.OperationResponse ( byte  operationCode,
object  dataContract 
)
inline

Initializes a new instance of the OperationResponse class. This constructor calls SetParameters(object) and sets the OperationCode.

Parameters
operationCodeDetermines the OperationCode.
dataContractAll properties of the dataContract with the DataMemberAttribute are copied to the Parameters dictionary.
Photon.SocketServer.OperationResponse.OperationResponse ( byte  operationCode,
Dictionary< byte, object >  parameters 
)
inline

Initializes a new instance of the OperationResponse class. This constructor sets the Parameters and the OperationCode.

Parameters
operationCodeDetermines the OperationCode.
parametersDetermines the Parameters.

Member Function Documentation

void Photon.SocketServer.OperationResponse.SetParameters ( object  dataContract)
inline

Converts properties of an object to response Parameters. Included properties require the DataMemberAttribute.

Parameters
dataContractProperties of this object with the the DataMemberAttribute converted to Parameters.
void Photon.SocketServer.OperationResponse.SetParameters ( Dictionary< byte, object >  parameters)
inline

Replaces the Parameters with parameters .

Parameters
parametersThe parameters to set.

Property Documentation

string Photon.SocketServer.OperationResponse.DebugMessage
getset

Gets or sets the debug message. Error code 0 returns typically debug message "Ok".

byte Photon.SocketServer.OperationResponse.OperationCode
getset

Gets or sets the operation code. It allows the client to idenitfy which operation was answered.

Dictionary<byte, object> Photon.SocketServer.OperationResponse.Parameters
getset

Gets or sets the response parameters.

short Photon.SocketServer.OperationResponse.ReturnCode
getset

Gets or sets the error code. Code 0 means OK.

object Photon.SocketServer.OperationResponse.this[byte parameterKey]
getset

Gets or sets the paramter associated with the specified key.

Parameters
parameterKeyThe key of the parameter to get or set.
Returns
The parameter associated with the specified key. If the specified key is not found, a get operation throws a KeyNotFoundException, and a set operation creates a new paramter with the specified key.
Exceptions
System.NullReferenceExceptionThe Parameters property has not been initialized.