。作爲一個更復雜的項目的一部分,我們在自己的工作流持久層上工作,以工作流基礎爲工作流持久性(自己的提供者)
我得到了加載並保存運行,但有一個問題,只有不可用的工作流回來。我卡在某處,只是看不到在哪裏。
任何工作流我加載我加載這樣的:
WorkflowApplication wf2App = new WorkflowApplication(new WorkflowInstanceStoreTestsSimplePersistence());
wf2App.InstanceStore = store;
wf2App.Load(wfApp.Id);
這看起來不錯 - 我得到一個工作流回來。我連接處理程序,當我運行()...我得到...
...中止。
的原因是:
錯誤處理當前工作項目已經引起了工作流程中止。詳情請參閱 內部例外。
內部異常是:InstanceStore的
的持久性提供者實現不支持命令 名爲{甕:架構 - 微軟COM:System.Activities.Persistence /命令} SaveWorkflow。 要麼選擇不同的提供者,要麼確保嘗試使用此持久性命令不是 。
真正的問題是,我沒有看到我的實現。我從來沒有返回錯誤,並且每個調用都返回而沒有錯誤。
堆棧跟蹤不樂於助人之一:
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.Runtime.DurableInstancing.InstancePersistenceContext.ExecuteAsyncResult.End(IAsyncResult result)
at System.Runtime.DurableInstancing.InstancePersistenceContext.EndOuterExecute(IAsyncResult result)
at System.Runtime.DurableInstancing.InstanceStore.EndExecute(IAsyncResult result)
at System.Activities.WorkflowApplication.PersistenceManager.EndSave(IAsyncResult result)
at System.Activities.WorkflowApplication.UnloadOrPersistAsyncResult.OnPersisted(IAsyncResult result)
at System.Runtime.AsyncResult.SyncContinue(IAsyncResult result)
at System.Activities.WorkflowApplication.UnloadOrPersistAsyncResult.Persist()
at System.Activities.WorkflowApplication.UnloadOrPersistAsyncResult.CollectAndMap()
at System.Activities.WorkflowApplication.UnloadOrPersistAsyncResult.Track()
at System.Activities.WorkflowApplication.UnloadOrPersistAsyncResult.EnsureProviderReadyness()
at System.Activities.WorkflowApplication.UnloadOrPersistAsyncResult.InitializeProvider()
at System.Activities.WorkflowApplication.UnloadOrPersistAsyncResult..ctor(WorkflowApplication instance, TimeSpan timeout, PersistenceOperation operation, Boolean isWorkflowThread, Boolean isInternalPersist, AsyncCallback callback, Object state)
at System.Activities.WorkflowApplication.BeginInternalPersist(PersistenceOperation operation, TimeSpan timeout, Boolean isInternalPersist, AsyncCallback callback, Object state)
at System.Activities.WorkflowApplication.OnBeginPersist(AsyncCallback callback, Object state)
at System.Activities.Runtime.ActivityExecutor.PersistenceWaiter.PersistWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
我所有的指令操作都在InstanceStore覆蓋了TryCommand和剛工作沒有錯。
爲SaveWorkflowCommand的處理程序是:
無效臨
cessSaveWorkflow (InstancePersistenceContext context, SaveWorkflowCommand command)
{
if (command.CompleteInstance)
{
DataStore.DeleteInstance(context.InstanceView.InstanceId);
DataStore.DeleteInstanceAssociation(context.InstanceView.InstanceId);
return;
}
if (command.InstanceData.Count > 0 || command.InstanceKeyMetadataChanges.Count > 0)
{
if (!DataStore.SaveAllInstanceData(context.InstanceView.InstanceId, command))
{
DataStore.SaveAllInstanceMetaData(context.InstanceView.InstanceId, command);
}
if (command.InstanceKeysToAssociate.Count > 0)
{
foreach (var entry in command.InstanceKeysToAssociate)
{
DataStore.SaveInstanceAssociation(context.InstanceView.InstanceId, entry.Key, false);
}
}
return;
}
}
,沒有問題(數據存儲調用我僅僅指剛在這裏不公佈)的作品。
我開始h I我可能會忘記一些電話來設置好狀態,但我遵循Pro WF(for 4.0)(本書)中的示例,它不起作用。
任何想法?
我對InstanceStore的實現沒有太多的瞭解。你有沒有看過這些[示例](http://www.microsoft.com/download/en/details.aspx?id=21459)? – Joao
具體的* XmlWorkflowInstanceStore *位於* WF \ Application \ PurchaseProcess \ CodedWorkflow \ CS \ WfDefinition *。它確實看起來你錯過了某個地方的某個調用。 – Joao