Today I want to show how we can use “Enterprise Architect” and the LieberLieber “Amuse” Plug-In to integrate “ASP.NET Mvc Web Application” into a flowchart.

Here you can see the final solution.
[mediaplayer src=’/wp-content/uploads/AmuseMvcExample.wmv’ autoLoad=1 autoPlay=1]

To download the video click here.

If you haven’t seen my previous posts please check out “LieberLieber AMUSE – Using Statemachines to Build Winforms flows” and “LieberLieber AMUSE – Using Statemachines and ASP.NET WebServices”.

Ok, first of all have a look at the Mvc Solution.


As you can see I added an AuthenticationController (provides the controller methods), AuthenticationService (provides the authentication logic) and AuthenticationViewModel (provides the view model for the web form) to the solution.

The authentication workflow looks similar like in my first example.


First we want to show the login form (ValidateUser.aspx) which provides username and password.


If the user enters the wrong username and password we want to show him the access denied form (AccessDenied.aspx).


If the authentication succeeds we want to show the user the succeed form (LoginSuccessful.aspx).


In “Enterprise Architect” I created 4 “Packages” and loaded the necessary source files to have a good overview of the Mvc solution.

1. “AmuseMvc” which holds the “StateMachine”.

2. “Controllers” which contains the Mvc controllers.

3. “Models” which contains the Mvc view models and authentication service.

4. “Views” which contains the Mvc views.

If you want to use your “ Mvc Web Application” in Amuse you have to build it and load it under “External References” at the “State Machine” diagram.

1. “Add-Ins” – “Amuse” – “External Reference”.

2. Now select your Mvc library. In our example “AmuseMvcExample.dll”.

3. Then import all three “Types” into “Enterprise Architect”:

a. “AmuseMvcExample.Controllers. AuthenticationController”

b. “AmuseMvcExample.Models. AuthenticationViewModel”

c. “AmuseMvcExample.Models. AuthenticationService”

But hold on, one important reference is missing. Maybe you remember my last post
LieberLieber AMUSE – Using Statemachines and ASP.NET WebServices” where we used the
“ASP.NET Development Server” and had to use a batch file to start the “ASP.NET Web Development Server”? To avoid this and make it more confortable I created a “WebDevServer” class which provides the necessary functionality (for example: Start, Stop and RedirectToAction). You can find this in the “AmuseMvc.dll”
So add also “AmuseMvc. WebDevServer” to the “StateMachine” diagram.

After we loaded all the external references, your “Project Browser” should look like in the following screenshot:


Ok now I declared the attributes.

Name: “ValidUser”
Type: “bool”
Scope: “Public”
Initial: “false”

Name: “MyAuthenticationViewModel”
Type: “AuthenticationViewModel”
Scope: “Public”

Name: “MyAuthenticationService”
Type: “AuthenticationService”
Scope: “Public”
Initial: “new AuthenticationService()”

Name: “MyAuthenticationController”
Type: “AuthenticationController”
Scope: “Public”
Initial: “new AuthenticationController ()”

Name: “MyWebDevServer”
Type: “WebDevServer”
Scope: “Public”
Initial: “new WebDevServer(“C:\YourProjectPath“)

–> The WebDevServer needs the path to the “ Mvc Web Application” (without last backslash)!

Now we create the operations:

Name: “StartWebDevServer”
Return Type: “void”
Behavior – Initial Code: “MyWebDevServer.Start();”

Name: “StopWebDevServer”
Return Type: “void”
Behavior – Initial Code: “MyWebDevServer.Stop();”

Name: “OpenLoginForm”
Return Type: “void”
Behavior – Initial Code:
“MyAuthenticationViewModel =
(AuthenticationViewModel) MyDevServer.GetViewModelFromAction(“Authentication”, “ValidateUser”,typeof (AuthenticationViewModel))

–> This operation redirects to the action and get the entered values back.

Name: “ValidateUser”
Return Type: “void”
Behavior – Initial Code: “ValidUser = MyAuthenticationService.ValidateUser(

–> This operation validates against our “AuthenticationService” and set the “ValidUser” attribute.

Name: “OpenAccessDeniedForm”
Return Type: “void”
Behavior – Initial Code: “MyDevServer.RedirectToAction(“Authentication”,”AccessDenied”);”

–> This operation opens the access denied form and we don’t need any return value.

Name: “OpenAccessDeniedForm”
Return Type: “void”
Behavior – Initial Code: “MyDevServer.RedirectToAction(“Authentication”,”LoginSuccessful”);”

–> This operation opens the login successful form and we don’t need any return value.

So now we can call the operations in the workflow but first we will add two new “States” for “StartDevServer” and “StopDevServer” like in the following screenshot.


So now we call the operations on the states:


Before we can start the flowchart we have to do two more things.

First import the namespaces in the “AmuseMvc” class.
using AmuseMvcExample.Controllers;
using AmuseMvcExample.Models;
using AmuseMvc;

And second in the “ Mvc Web Application”, we have to add the “AmuseMvcWeb.dll” which provides the “AmuseHandler “. You have to set up this handler in the web.config.
Add following line to the <httpHandlers> section:

<add verb="*" path="*.amusemvc" type="AmuseMvcWeb.AmuseHandler"/>

And also don’t forget to add following line into the “Global.asax.cs” – “RegisterRoutes” method:

 Public class MvcApplication : System.Web.HttpApplication {
   public static void RegisterRoutes(RouteCollection routes) {

The library also contains the “AmuseAttribute” for the controller classes. So if you want to use the controller in Amuse please mark the controller class with [Amuse]:

In our example over the “AuthenticationController”.

public class AuthenticationController : Controller {
  private readonly IauthenticationService _authenticationService;
  public AuthenticationController() {
    _authenticationService = new AuthenticationService();

After that we are ready to go and you can start the flowchart!

If you want to try this example please make sure that you change the path for the WebDevServer to the Mvc Application first!!

Attribute: MyWebDevServer = new MyWebDevServer(“YOURPATH”);

To pass the validation use:

Here is the source code.