Example #1
0
 public void DOAction(EntityAction action)
 {
     if (handlers.TryGetValue(action.GetType(), out IActionHandler handler))
     {
         handler.OnAction(action);
     }
 }
Example #2
0
        /// <summary>
        /// Performs an action in the system.
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="action">The record to which the action should be applied and the parameters of the action.</param>
        /// <returns>ApiResponse of Object(void)</returns>
        protected ApiResponse <Object> InvokeActionWithHttpInfo(EntityAction <EntityType> action)
        {            // verify the required parameter 'action' is set
            if (action == null)
            {
                ThrowMissingParameter("InvokeAction", nameof(action));
            }

            var localVarPath = GetEndpointPath() + "/" + GetEntityName() + "/" + action.GetType().Name;

            // make the HTTP request
            RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                    Method.Post, ComposeEmptyQueryParams(), ComposeBody(action), ComposeAcceptHeaders(HeaderContentType.Json), ComposeEmptyFormParams(), ComposeEmptyFileParams(),
                                                                                                    ComposeEmptyPathParams(), ComposeContentHeaders(HeaderContentType.Json)).Result;

            VerifyResponse <EntityType>(localVarResponse, "InvokeAction");

            return(GetResponseHeaders(localVarResponse));
        }
Example #3
0
    public void OnAgentDestroy(State state)
    {
        this.Foreach((component) =>
        {
            var agent = component as IStateAgent;
            if (agent != null)
            {
                agent.OnAgentDestroy(state);
            }
        });

        EntityAction action = state as EntityAction;

        if (action != null)
        {
            ObjectPool.ReturnInstance(action, action.GetType());
        }
    }