Class MyServerInvoker
A web DataStore used for JavaScript clients communicating through to a DataStore.
public class MyServerInvoker : WebServerInvoker, IWebServerInvoker
- Inheritance
-
MyServerInvoker
- Implements
- Derived
- Inherited Members
Remarks
The maximum number of concurrent connections per server is 64, provided by the default HttpMessageHandler. It can be increased/decreased by providing a custom instance of HttpMessageHandler.
Constructors
MyServerInvoker(string, int?, string?, HttpMessageHandler?, ApiClientConfiguration?)
Initializes a new instance of the MyServerInvoker class.
public MyServerInvoker(string url, int? timeout = null, string? servicePath = null, HttpMessageHandler? handler = null, ApiClientConfiguration? apiClientConfiguration = null)
Parameters
url
stringThe URL.
timeout
int?The request timeout in milliseconds. (Default 300000 and this is the maximum).
servicePath
stringPath to web service. [Default "apiv1"].
handler
HttpMessageHandlerThe HttpMessageHandler for overriding of the default shared httpClient (max connection pool size 64).
apiClientConfiguration
ApiClientConfigurationThe ApiClientConfiguration provided by the API client for custom configurations.
Methods
CheckForError(string, Exception?, JsonRpcErrorCode?, JsonRpcErrorData?)
Check JSON error.
protected override Exception? CheckForError(string message, Exception? innerException, JsonRpcErrorCode? errorCode, JsonRpcErrorData? errorData)
Parameters
message
stringThe error message.
innerException
ExceptionThe inner exception.
errorCode
JsonRpcErrorCode?The JsonRpcErrorCode for JSON-RPC error type that occurred.
errorData
JsonRpcErrorDataPrimitive or Structured value that contains additional information about the error.
Returns
- Exception
The Exception object.
OnDerivableErrorCode(string, Exception?, JsonRpcErrorCode?, JsonRpcErrorData)
Let other derived invokers handle their own exception types.
protected virtual Exception? OnDerivableErrorCode(string message, Exception? innerException, JsonRpcErrorCode? errorCode, JsonRpcErrorData errorData)
Parameters
message
stringThe exception message.
innerException
ExceptionThe inner exception.
errorCode
JsonRpcErrorCode?The error code.
errorData
JsonRpcErrorDataThe error data.
Returns
- Exception
The delineated exception, or base implementation.
Remarks
This could further be broken down into the derived invoker classes. Kept the core logic here.
ToJson(object)
Convert object to JSON string.
protected override string ToJson(object obj)
Parameters
obj
objectThe object to be converted.
Returns
- string
The JSON string result.
ToJsonContent(object)
Gets JsonContent wrapped serialization target.
protected override JsonContent ToJsonContent(object serializationTarget)
Parameters
serializationTarget
objectThe object for seralization.