This project is read-only.

Loading selected assemblies into TaskFactory

Jun 1, 2008 at 3:40 PM
By default, the TaskFactory will loop through all types in every loaded assembly. On my ASP.NET MVC app, that works out to about 57 assemblies, including things like NHibernate, log4net, and base class libraries. I notice there is a constructor on TaskFactory that will allow you to limit this only to specified assemblies but I don't know how to access it.
Coordinator
Jun 1, 2008 at 11:14 PM
I just checked in a version that will allow you specify which assemblies to load tasks from in two different ways

1. Add a new statement to your state machine definition (Order.boo demonstrates this technique in the sample project)
        action_assembly "My.Assembly.Name"
2. Call RegisterTaskAssembly on StateMachine BEFORE trying to build it with the builder.
    StateMachine newMachine = new StateMachine();
    newMachine.RegisterTaskAssembly(GetType().Assembly);
   stateMachineBuilder.BuildStateMachine(newMachine);

Hope that does the trick. Let me know if it gives you any trouble.



kbaley wrote:
By default, the TaskFactory will loop through all types in every loaded assembly. On my ASP.NET MVC app, that works out to about 57 assemblies, including things like NHibernate, log4net, and base class libraries. I notice there is a constructor on TaskFactory that will allow you to limit this only to specified assemblies but I don't know how to access it.



Developer
Jun 3, 2008 at 10:17 PM
Hi,

first of all, this looks like a very cool library. very powerful stuff :)

I've downloaded the source (SimpleStateMachine-8007.zip) and noticed the action_assembly method. Only the exception message contains the text:

                throw new Exception("Task assembly " + assemblyName +
                                    " cannot be resolved. Please check your task_assembly statements to ensure they reference assemblies accessible to the runtime environment.");

shouldn't the method name be task_assembly ?

cheers,
ernst.


Coordinator
Jun 3, 2008 at 11:50 PM
Thank you for the heads up - the exception should read 'action_assembly', not 'task_assembly', and now it does. I used task_assembly originally, but I am calling the transition actions Actions, so I ended up with action_assembly as the keyword in the DSL.

ernstnaezer wrote:
Hi,

first of all, this looks like a very cool library. very powerful stuff :)

I've downloaded the source (SimpleStateMachine-8007.zip) and noticed the action_assembly method. Only the exception message contains the text:

                throw new Exception("Task assembly " + assemblyName +
                                    " cannot be resolved. Please check your task_assembly statements to ensure they reference assemblies accessible to the runtime environment.");

shouldn't the method name be task_assembly ?

cheers,
ernst.