CorrelationInitializer question
Hi, I'm new to wwf, and I have the following question,
In all the available application samples I browsed the CorrelationInitializer is always attributed to a method, and not to an event. Is there a reason for this?
The usual is something like:
[ExternalDataExchange]
[CorrelationParameter("nextStage")]
public interface ISMConnector
{
[CorrelationAlias("nextStage", "e.Command")]
event EventHandler<RegEventArgs> OwnerInfoSubmitted; [CorrelationInitializer()]
void SMSnapshot( string nextStage);
}
I had originally thought of doing something more like:
[CorrelationParameter("WorkflowInstanceId")]
[ExternalDataExchange]
public interface ICaseManagementLocalService
{
[CorrelationInitializer]
[CorrelationAlias("WorkflowInstanceId", "e.Case.WorkflowInstanceId")]
event EventHandler<CaseEventArgs> CaseCreated; [CorrelationAlias("WorkflowInstanceId", "e.Case.WorkflowInstanceId")]
event EventHandler<CaseEventArgs> CaseUpdated;
}
Is there a problem with defining the CorrelationInitializer as an event? (I'm having problems with this approach).
thanks,
GLR
[1488 byte] By [
gabo_uy] at [2007-12-22]
Yeah, I'm getting
EventDeliveryFailedException: Event "CaseUpdated"....System.InvalidOperationException: Workflow with id "d9c3f57b-2<BR>834-47a7-8403-649cc7bfd175" not found in state persistence store.
This happens when I execute this piece of code to test the wf:
CaseData cd = GetDummyCaseData();
CaseManager manager = new CaseManager();
//raises CaseCreated event
string instanceid = manager.OpenNewCase(caseData);
caseData.WorkflowInstanceId = instanceid;
caseData.CaseStatus = "Assigned";
caseData.AssignedTo = "technician";
//raises CaseUpdated event
manager.UpdateCase(caseData, "dispatcher");
But I'm not paying much attention to the exception because I know things are already inconsistent before I get the exception.The state machine defined looks like this, and the initial state is something like this.
When I raise the CaseCreated event, I know the handleExternalEventActivity1_Invoked handler gets invoked, because it writes in the EventLog, but the second activity (PersistCaseData, the code activity) never gets executed.
Persistence service is enabled, if I look at the persistence database, each time I run the test code, a new row appears in the WorkflowInstance table. So I guess It's just unloading on idle somewhere, but I don't get why, and why it just doesn't run the code activity and continue to the next state.
Any hint will be appreciated,
thanks,
GLR