This project is read-only.

BuildApp – StepInstanceActivator

This step is more complicated. First, the right type within the current AppDomain must be found by the defined name within the flow definition:

/// <summary>Helper function to find a type given by its step definition
/// </summary>
/// <param name="app">App definition</param>
/// <param name="stepDefinition">Step definition of the type</param>
/// <returns>Returns the type instance</returns>
private Type GetTypeByFDLStepDefinition(AppDefinition app, FDLStepDefinition stepDefinition) {

	List<Type> tPossibleTypes = new List<Type>();
	string tTypeName;
	if (stepDefinition.TypeName.Contains("."))
		tTypeName = stepDefinition.TypeName; // It's a full qualified name.
 		tTypeName = "." + stepDefinition.TypeName;
 		// The . is important to find the type (Namespace.Type)

	foreach (Assembly tAssembly in AppDomain.CurrentDomain.GetAssemblies()) {
		//It's not allowed to examine dynamic assemblies => ignore
		// see:
		if (!tAssembly.IsDynamic) {
			foreach (Type tType in tAssembly.GetExportedTypes()) {
				if (tType.ToString().EndsWith(tTypeName))
		if (tPossibleTypes.Count == 1)
			return tPossibleTypes[0];
		else if (tPossibleTypes.Count == 0)
			//Error logging …
			// …


As you see, the AppBuilder uses the primary class name to identify the step instance. If you have multiple classes with the same name, you have to use the full qualified name within the flow definition.

Afterwards, the AppBuilder knows the type to activate. If a prepared instance has the expected name, the AppBuilder takes this given instance instead. If no prepared instance is available, the AppBuilder creates one.

You can also use static classes! In this case, the AppBuilder connects the static class instead.
As a result, all used steps are stored in AppDefinition.StepInstance.

Last edited Apr 22, 2013 at 9:40 AM by InneHo, version 5


No comments yet.