RuleChainedContext & AddOutput values

RuleChainedContext & AddOutput values

Old forum URL: forums.lhotka.net/forums/t/10319.aspx


mosgath posted on Thursday, April 28, 2011

I working with CSLA 4.1 and ran into a scenario that I wanted to get some input on.  Basically, I have a rule that updates some data using the AddOutput method but then has the need to chain another rule.  I use the syntax below to pass the context.  However, the context does not have the updated values from the AddOutput.  Since these don't get applied to the actual target until the rule completes.  Since the these rules may be called Asynchronously from Silverlight or synchronously from a server side component, I am trying to minimize the amount of areas that update the target directly for all the reasons stated in other posts on this forum.  Is there a way to get access to the updated values inside the chained rule from inside the original rule?


     if (myObject.myCondition == true )
{   AddOutput<bool>(ref context, myObject.myProperty, true);}

IBusinessRule _my2ndRule = (IBusinessRule)new Model.BusinessRules.my2ndRule(PrimaryProperty, ConditionProperty);

_my2ndRule.Execute(context.GetChainedContext(_my2ndRule));


 

 

Copyright (c) Marimer LLC