Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows WF Server table Data , +
Hi Folks,
 
I am working in Windows Workflow Foundation 4.5.I need some pointers in Persistence and tracking concepts.
 
I can able to persist the Workflow Application by creating an Instance and saved in Persistence Store [Instances Table ] in SQL Server 2008.
 

And by passing the Exact GUID to unload the Workflow Instance and load it back to the Application memory.
 
For the Reference I have created a seperate GUID column in the user input Data Table and the same GUID got stored in the Instances table.So by unloading the particular Instance ID or GUID , the app got loaded back with the Data.
 
Now if I Switch off the machine with the SQL server with User Input Data table or suppose if the server got crashed , how can we retrieve the Data from the Persistence Store.
 
Is it possible ? Is the instances table or any table will hold those values in it by any method ? I am not clear with this..
 
Please help !
 
Thanks in Advance.
Posted 14-May-13 21:04pm
Prasyee1.4K
Edited 3-Oct-13 22:19pm
v5
Comments
Sunasara Imdadhusen at 11-Jun-13 1:48am
   
Where is your code snippet?
Prasyee at 4-Oct-13 3:18am
   
public void GenerateInstanceStore(WorkflowApplication WorkApp, Guid id)
{
WFInstStore = new SqlWorkflowInstanceStore(WFInstanceConnStr);
WFInstStore.InstanceCompletionAction = InstanceCompletionAction.DeleteNothing;
try
{
WorkApp.InstanceStore = WFInstStore;
id = WorkApp.Id;
WFHostTypeName = XName.Get("Version" + id.ToString(), typeof(Activity).FullName);
WFInstHandle = CreateInstanceStoreOwnerHandle(WFInstStore, WFHostTypeName);
Dictionary wfScope = new Dictionary
{
{
WorkflowHostTypePropertyName, WFHostTypeName
}
};
 
WorkApp.AddInitialInstanceValues(wfScope);
WorkApp.Completed = (e) => { completed = true; };
WorkApp.PersistableIdle = (e) => { return PersistableIdleAction.Persist; };
WFapphandle.Set();
WorkApp.Persist();
}
catch (Exception ex)
{
Obj_LogException.MyLogFile(ex.ToString());
}
finally
{
ReleaseObject(Obj_LogException);
ReleaseObject(Obj_LogFile);
ReleaseObject(WFInstStore);
//ReleaseObject(WFHostTypeName);
}
}
 

for unloading
 

public void LoadWinAppInstance(WorkflowApplication WinWFApp, Guid Gid)
{
//SqlWorkflowInstanceStore WFLoadInstStore = new SqlWorkflowInstanceStore(ConfigurationManager.AppSettings["PersistenceWorkflow"].ToString());
WFInstStore = new SqlWorkflowInstanceStore(WFInstanceConnStr);
WFInstStore.InstanceCompletionAction = InstanceCompletionAction.DeleteNothing;
try
{
WFHostTypeName = XName.Get("Version" + Gid.ToString(), typeof(Activity).FullName);
WFInstHandle = CreateInstanceStoreOwnerHandle(WFInstStore, WFHostTypeName);
WinWFApp.Completed = (WorkflowCompletedEventArgs) =>
{
completed = true;
};
WinWFApp.Unload();
}
catch (Exception ex)
{
Obj_LogException.MyLogFile(ex.ToString());
}
finally
{
//ReleaseObject(WFHostTypeName);
ReleaseObject(WFInstStore);
//ReleaseObject(WinWFApp);
ReleaseObject(Obj_LogFile);
ReleaseObject(Obj_LogException);
//ReleaseObject(Gid);
}
}
Prasyee at 4-Oct-13 3:18am
   
public InstanceHandle CreateInstanceStoreOwnerHandle(InstanceStore store, XName WFHostTypeName)
{
InstanceHandle ownerHandle = store.CreateInstanceHandle();
CreateWorkflowOwnerCommand ownerCommand = new CreateWorkflowOwnerCommand()
{
InstanceOwnerMetadata =
{
{
WorkflowHostTypePropertyName, new InstanceValue(WFHostTypeName)
}
}
};
store.DefaultInstanceOwner = store.Execute(ownerHandle, ownerCommand, TimeSpan.FromSeconds(30)).InstanceOwner;
return ownerHandle;
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,192
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 4 Oct 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100