The external service class to be called needs to first inherit the ExternalServiceBase class and implement the IExternalService interface. The following OrderSubmitService class is a specific implementation class.

Please refer to the Slickflow.Module.External project.

///<summary>

/// Order submission service class (corresponding to the order submission node in the order process)

///</summary>

publicclass OrderSubmitService : ExternalServiceBase, IExternalService

{

///<summary>

/// Business logic pre-call method

///</summary>

publicoverridevoid Execute()

{

//Implement the user's own business logic

var id = DelegateService.GetID();

var amount = DelegateService.GetVariable( "amount" );


DoSomethingElse(amount, 20);

}


///<summary>

/// Business logic specific implementation method

///</summary>

///<param name=" amount "></param>

///<param name=" newAmount "></param>

private void DoSomethingElse( string amount, int newAmount)

{

var intAmount = 0;

int .TryParse(amount, out intAmount);


if (intAmount < newAmount)

{

DelegateService.SetVariable( "amount" , newAmount.ToString());

}


//Call other business processing logic

var session = DelegateService.GetSession();


//Implement other database business logic

//.............................

}

}

       During the execution of the engine flow, when the Action definition that calls an external event is parsed on the node, the reflection method will be used to find whether the component has an OrderSubmitService class, and whether it is a service class that implements the ExtneralServiceBase and IExternalService interfaces, so that the Execute() method can be executed. It must meet the above-mentioned search base class inheritance and interface implementation conditions to be reflected and executed, otherwise it cannot be executed. This ensures that the clearly defined event program code is executed.