Quantcast
Viewing all articles
Browse latest Browse all 764

Validation Rule for two Property Strange

Hi all..

I'm learning about Business Rules  Engine on CSLA 4, so I post my another question on http://forums.lhotka.net/forums/p/12091/56013.aspx#56013, thanks jonny :)

I have an example for my real rule which is I don't understand it's behavior.

  public class CardNumberCustomerRule : BusinessRule
    {
        public CardNumberCustomerRule(Csla.Core.IPropertyInfo primaryProperty,
            Csla.Core.IPropertyInfo custProperty)
            : base(primaryProperty)
        {
            InputProperties = new List<Csla.Core.IPropertyInfo> { PrimaryProperty, custProperty };
        }

        protected override void Execute(RuleContext context)
        {
            ........
        }
    } // end of class

 

My Question is : this rule is called twice, which are :

1. when my custProperty on my BO is set , use SetProperty ( this is call FIRST, I don't know why the rule called on this step ? ) Am I wrong if My Understanding at this step is the rule should not be run ?

2. when my PrimaryProperty on my BO is set , use SetProperty ( I Accept, and this is what I want )

 

thanks a lot

 

stefanus


Viewing all articles
Browse latest Browse all 764

Trending Articles