index > Windows Workflow Foundation > set .Rules file from host

set .Rules file from host

i have created one SequentialWorkflow project and placed IfActivity

and put one codeActivity1 in elsebranch1 and CodeActivity2 in elsebranch2

when i set Rule condition it automatically creates one .rules file.

but from host i need to apply new .rules file?

i have given following code

workflowInstance1 = workflowRuntime.CreateWorkflow(type, parameters);

ChangeRules(workflowInstance1);

workflowInstance1.Start();

waitHandle.WaitOne();

---------------------

static void ChangeRules(WorkflowInstance Instance)

{

if (wasChanged)

return;

wasChanged = true;

// Dynamic update of rule

WorkflowChanges workflowchanges = new WorkflowChanges(Instance.GetWorkflowDefinition());

CompositeActivity transient = workflowchanges.TransientWorkflow;

RuleDefinitions ruleDefinitions = (RuleDefinitions)transient.GetValue(RuleDefinitions.RuleDefinitionsProperty);

WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer();

object obj = serializer.Deserialize(new XmlTextReader("C:\\DynamicRulesWorkflow.rules"));

ruleDefinitions = (RuleDefinitions) obj ;

Instance.ApplyWorkflowChanges(workflowchanges);

Console.WriteLine(ruleDefinitions.Conditions[0].ToString());

}

but it is taking old .rule file

what is the solution for this issue?

Ravi Kiran Guturu

Replace the statements:

RuleDefinitions ruleDefinitions = (RuleDefinitions)transient.GetValue(RuleDefinitions.RuleDefinitionsProperty);

ruleDefinitions = (RuleDefinitions) obj ;

with:

transient.SetValue(RuleDefinitions.RuleDefinitionsProperty, obj );

.




Jurgen Willis - Program Manager - Windows Workflow Foundation
Jurgen Willis
reply 2

You can use google to search for other answers

 

More Articles

• Workflow Instances
• Pricing
• Select Approver - activity
• Advice on where to begin
• StartWorkflow Method
• Does Office Release Delay Equate to WF Release Delay?
• Problem with activity execution status
• Rehydration and member variables
• Problem running my first workflow enabled webform
• Extending the WinWF Designer
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Tracking query does not return any workf
• How to debug with RunWorkflow method?
• WWF Rules Engine vs ILOG Rules Engine
• SqlTrackingService does not work in Beta
• How to debug a XOML-Only Workflow?
• Will there be a WF official release with
• Activity.DesignMode true when initializi
• Lotus workflow
• Beta2, StatePersistenceService Load/Save
• I know WWF is still in Beta form but it
• Migrating persisted workflows to a new a
• Problems migrating a TrackingService imp
• loading workflow from xoml file
• Visual Studio Crashes During Compile
• SqlTrackingQuery comments and questions

Hot Articles

• Re: Installing Windows Workflow Foundati
• Create a code expression with RuleCondit
• BaseTypeAttribute class is dropped
• How to make a custom composite activity
• Will there be a cost for WWF?
• Workflow designer ignores DefaultValueAt
• Accessing Data after the WF Completes
• SimpleExpenseReport
• Custom Activity
• Debug step into code behind SharePoint S
• Input and Output paramters in WinForm Ap
• wf.Parameters
• Workflow terminated by runtime - error d
• Beta2: String-Properties in Custom Activ
• Why and How StateMachineWorkflow in ASP.

Recommend Articles

• how to access output parameters from wor
• Can TargetStateName of SetState Activity
• Change Title in Sequential Workflow
• How to create a new workflow instance at
• Error : ExpenseReporting - 2006-03
• Pondering
• Rehydration and member variables
• re: Getting Here
• Deserialize XAML
• While() activity a cpu hog
• Example faulthandleractivity Office Shar
• What are the alternatives to using GetAc
• navigate page/forms?
• Workflow Runtime Accepts HandleExternalE
• ASP.NET and WF viable?