wcf - Avoiding "An Activity can only get the location of arguments which it owns." -


this follow-up question setting internal properties in composite wf4 activities @ design time.

i creating composite windows workflow activity (under .net 4) contains receive , sendreply activities of properties predefined. nativeactivity, not activity template. (see @maurice's reply above question example.)

if attempt set inargument associated internal sendreply execute (using parent's context), invalidoperationexception:

an activity can location of arguments owns. activity 'createinstance' trying location of argument 'parameter0' owned activity 'sendreply'.

in case i'm trying set correlationhandle, believe affect sendparameterscontent parameters well. how can work around this?

here update version of cachemetadata stores input argument in variable , uses in response , sets correlationhandle. basic trick add them variable using addimplementationvariable, because activities added using addimplementationchild.

protected override void cachemetadata(nativeactivitymetadata metadata) {     _receive = _receive ?? new receive();     _sendreply = _sendreply ?? new sendreply();     _receive.cancreateinstance = true;     metadata.addimplementationchild(_receive);     metadata.addimplementationchild(_sendreply);      _receive.servicecontractname = servicecontractname;     _receive.operationname = operationname;      var correlationhandle = new variable<correlationhandle>("correlationhandle");     metadata.addimplementationvariable(correlationhandle);     var correlationinitializer = new requestreplycorrelationinitializer()     {         correlationhandle = new inargument<correlationhandle>(correlationhandle)     };     _receive.correlationinitializers.add(correlationinitializer);       var firstname = new variable<string>("firstname");     metadata.addimplementationvariable(firstname);     var args = new receiveparameterscontent();     args.parameters["firstname"] = new outargument<string>(firstname);     _receive.content = args;       _sendreply.request = _receive;     var results = new sendparameterscontent();     results.parameters["greeting"] = new inargument<string>(new visualbasicvalue<string>("\"hello \" & firstname"));     _sendreply.content = results;      base.cachemetadata(metadata); } 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -