I have a base class called "BaseActivity" Derived from a NativeActivity. I want to have all my common behavior in the base class and make use of them in the dervied classes. Let's say i have common in / out arguments in base class. My derived classes have its own in / out arguments. My question is, how can i pass an out argument from my dervied class to the base class, so that the base class out argument will pass the message back to the client?
BASEACTIVITY CLASS
public class BaseActivity : NativeActivity { #region "Public Argument List" // Define an activity input / output argument of type string public InArgument FirstArgument{ get; set; } public InArgument SecondArgument{ get; set; } public OutArgument Result { get; set; }
public virtual NativeActivityContext PushContext(NativeActivityContext context, Dictionary DictBase) { return context; }
protected override void CacheMetadata(NativeActivityMetadata metadata) { base.CacheMetadata(metadata);
}
protected override void Execute(NativeActivityContext context) {
// Read context variables to local string variables.
string firstVal= context.GetValue(this.FirstArgument);
string secondVal= context.GetValue(this.SecondArgument);
string OutputResult = context.GetValue(this.Result);
Dictionary<string, object> contextdictionary = new Dictionary<string, object>();
contextdictionary.Add("first", firstVal);
contextdictionary.Add("second", secondVal);
contextdictionary.Add("output", OutputResult);
NativeActivityContext finalContext = PushContext(context, contextdictionary);
}
}
DERIVED CLASS
public class Child: BaseActivity { public InArgument XsltPath { get; set; } public OutArgument OutValue{ get; set; }
public override NativeActivityContext PushContext(NativeActivityContext context, Dictionary DictBase) { // Some String manipulation and then pass it. OutValue.Set(context, outputStringBuilder.ToString());
}
return context;
}
}
The question is how can i pass the OutValue to the base activity out argument. The value in the child activity is correct but when i invoke a worklfow it returns an empty string. pl. help me. Thanks in Advance.