workflows to it (register if you like) before running it. Of course we can add it through code; However it is rigid. The most flexible and liked way is do IoC with app.config file. The following snippet shows the two ways.
// with hard code
instance.AddService(new MyWorkflow(p1, p2));
instance.AddService(new MyWorkflow2(p1, p2, p3));
instance.StartRuntime();
// with app.config
-configuration
--configSections
---setion name="WorkflowRuntime" type=""
-WorkflowRuntime Name = ""
--CommonParameters
---add name="" value=""
-Services
--add type=""
To run a workflow:
//instance.CreateWorkflow(Type WorkflowType, Dictionary
instance.Start();
With values set in the configure file, new instance of WorkflowRuntime will reflect that configured values, as a result it already has the services we want to add. In this way, we can add different services to the runtime without needs of change code or recompile code.
No comments:
Post a Comment