Reputation: 2518
I'm currently charged of developing a way to use WF in our application and I have a set requirements that I need to follow.
I've been studying WF and I came up with some solutions but I'm not sure if they are the best ones.
One of my biggest problems is to make available to the activities an instace of the classes that define them. Is there a way to provide to the workflow runtime an activity factory or something like that? Another problem comes from using Pure XAML workflow definitions. I need to be able to pass the DataObject to the first activiy so it can be used in the workflow.
I have some difficulty explaining the problem, I hope its clear enough.
Any help will be appreciated. Thanks.
Upvotes: 1
Views: 462
Reputation: 2518
I think the WorkflowLoaderService
is the class I was looking for.
That should do it. Thanks.
Upvotes: 0
Reputation: 1531
I'm not quite sure I fully understand what you want to do, but you may want to look at a custom loader:
http://msdn.microsoft.com/en-us/magazine/cc507645.aspx
http://www.masteringbiztalk.com/blogs/jon/CommentView,guid,ffd20921-fb8b-42a2-98d1-8c8e1582a3fa.aspx
Upvotes: 1
Reputation: 2518
I've been looking at TypeProvider
but it seems like I can only add new locations for activities. However the runtime will continue to instantiate the activities himself.
I wanted to be able to instantiate them so I could pass some arguments to the contructor.
I solved the DataObject problem pretty much the way you described.
Upvotes: 0
Reputation: 1531
In relation to providing external activities to the runtime that are used within the context of a XOML workflow, take a look at adding a TypeProvider service to your runtime:
TypeProvider provider = new TypeProvider(runtime);
provider.AddAssembly(assembly);
runtime.AddService(provider);
Also, look at defining a root activity that has a DependencyProperty that is of your DataObject type. Make the root activity of your XOML based workflows of that base type. You should then be able to pass your object into the XOML based worflows as a parameter without any problems.
Upvotes: 1