Re: Help understanding CSLA 4 business rules subsystem

Re: Help understanding CSLA 4 business rules subsystem

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


Brendt posted on Wednesday, June 26, 2013

Hi Jonny.

 

thanks for your reply.

ok that makes sense, i see that my rule is being checked when creating my customer. nut i see now that my rule is not actually broken when i create a new customer, only after i change the property 'Name' and take out all of its contents so that it is empty is my object not valid, why is that? shouldnt the rullebe broken to begin with seen that there is nothing in the 'Name' property? how would i make sure that the rule is broken to begin with?

im using WinForms so what would be the best way to get a list of all broken rules and display on my UI form? i tried this but i dont seem to get the desired results back.

 public List<string> CheckRules()
        {
            base.CheckObjectRules();

            List<string> msgs = new List<string>();

            foreach (var rule in this.BrokenRulesCollection)
            {

                msgs.Add(rule.Description);
               

            }
          
            return msgs;
           
        }

Copyright (c) Marimer LLC