wcf - Providing workflow extensions to a workflow service - WF 4.0 -


greetings 1 , all!

i'm new wf 4.0 , wwf in general forgive me if seems newbie type of question, believe me i've scoured depths of internet solution problem, no avail.

i have created sample wf application custom codeactivity requires extension provided, per below:

public sealed class preparepizza : codeactivity {     public inargument<order> order { get; set; }      protected override void cachemetadata(codeactivitymetadata metadata)     {         base.cachemetadata(metadata);          if (this.order == null)             metadata.addvalidationerror("you must supply order.");          metadata.requireextension<ipreparepizzaextension>();     }     // if activity returns value, derive codeactivity<tresult>     // , return value execute method.     protected override void execute(codeactivitycontext context)     {         // obtain runtime value of text input argument         order order = context.getvalue(this.order);         var extension = context.getextension<ipreparepizzaextension>();         extension.prepare(order);     } }  public interface ipreparepizzaextension {     void prepare(order order); } 

i slot activity workflow service , attempt consume via web app adding service reference. however, when add reference get:

system.activities.validationexception: extension of type 'pizzaman.activitylibrary.ipreparepizzaextension' must configured in order run workflow.

fair enough - of course activity requires pass implementation of ipreparepizzaextension - after all, i've told to!

so question is, how on earth pass service? can manage enough in console app scenario, using workflowinvoker, cannot see obvious way via service approach. assume programmatic approach adding reference what's needed, again i'm @ loss precisely how go this.

any appreciated.

best regards ian

the workflowservicehost has workflowextensions property can add workflow extenstion. there several ways can that. if self hosting easy create workflowservicehost. if usign iis need create servicehostfactory configure workflowservicehost. there option add workflow extension in cachemetadata of activity using metadata.adddefaultextensionprovider() function.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -