DataDictionary.Rules.Action.GetChanges C# (CSharp) Метод

GetChanges() публичный Метод

Creates a list of changes to be applied on the system
public GetChanges ( InterpretationContext context, DataDictionary.Rules.ChangeList changes, ExplanationPart explanation, bool apply, Runner runner ) : void
context InterpretationContext The context on which the changes should be computed
changes DataDictionary.Rules.ChangeList The list of changes to be updated
explanation ExplanationPart The explanatino to fill, if any
apply bool Indicates that the changes should be applied immediately
runner Runner
Результат void
        public virtual void GetChanges(InterpretationContext context, ChangeList changes, ExplanationPart explanation,
            bool apply, Runner runner)
        {
            if (!DeActivated)
            {
                long start = Environment.TickCount;

                try
                {
                    if (Statement != null)
                    {
                        Statement.GetChanges(context, changes, explanation, apply, runner);
                    }
                    else
                    {
                        AddError("Invalid actions statement");
                    }
                }
                catch (Exception e)
                {
                    AddException(e);
                }

                long stop = Environment.TickCount;
                long span = (stop - start);

                if (RuleCondition != null && RuleCondition.EnclosingRule != null)
                {
                    // Rule execution execution time (as opposed to guard evaluation)
                    RuleCondition.EnclosingRule.ExecutionTimeInMilli += span;
                    RuleCondition.EnclosingRule.ExecutionCount += 1;
                }
            }
        }

Usage Example

Пример #1
0
        /// <summary>
        ///     Computes the changes related to this event
        /// </summary>
        /// <param name="apply">Indicates that the changes should be applied directly</param>
        /// <param name="runner"></param>
        public override bool ComputeChanges(bool apply, Runner runner)
        {
            bool retVal = base.ComputeChanges(apply, runner);

            if (retVal)
            {
                if (runner.Explain)
                {
                    Explanation = new ExplanationPart(Action, "Action ", Action);
                }

                InterpretationContext context = new InterpretationContext(Instance);
                Changes = new ChangeList();
                Action.GetChanges(context, Changes, Explanation, apply, runner);
                Changes.CheckChanges(Action);
            }

            return(retVal);
        }