开发者

Hosting Workflow-Foundation in Windows Services

I am in the process to implement a Windows Service which is hosting a "Sequential Workflow" (Windows Workflow-Foundation). The sequential workflow is quite simple and, basically, is nested in a while activity which never ends.

The primary purpose is to schedule jobs over a certain period of time.

Since the project shares part of the infrastructure with an ASP.NET MVC application, I would like to re-use what I've built so far. I've split the windows-service project in two part: the service itself and the workflow project.

The service is a "stupid" container with the only reference to the workflow; it's main purpose is to start it:

workflowEngine = new WorkflowRuntime();
WorkflowInstance instance = workflowEngine.CreateWorkflow(typeof(BpReminders.WorkFlow.Scheduler), parameters);
instance.Start();

The workflow-foundation project references all the other projects I need to use and is responsible for the dependency injection (structureMap).

I've created a prototype now and everything seem to work. Now, my dilemma is, should be the windows-service responsible to resolve the dependencies and inject those in the workflow or my approach is good enough considering that one day I migh开发者_运维问答t decide to change the host of the workflow? Is it possible, eventually, to use structureMap to inject the dependencies in a workflow project?


Since you would have to use property injection to inject into the workflow anyway, I would prefer to call the container inside the workflow to build up objects as needed. If you do want to do property injection, take a look at this: http://codebetter.com/jeremymiller/2008/10/09/setter-injection-in-structuremap-2-5/.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜