New Posts New Posts RSS Feed: need to get Verification errors on property setters
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

need to get Verification errors on property setters

 Post Reply Post Reply
Author
downeytim View Drop Down
Newbie
Newbie


Joined: 08-Dec-2009
Location: Dallas, Texas
Posts: 18
Post Options Post Options   Quote downeytim Quote  Post ReplyReply Direct Link To This Post Topic: need to get Verification errors on property setters
    Posted: 22-Feb-2010 at 6:52pm
I am running the LightHouse WPF sample.  When I open the employees panel and change the Hire Date to an invalid date I can see the error on the screen in your sample code.  I need to display all these types of verification results in a tree view control. 
 
I have about 10 different objects in play at a time in my application.  Many of the fields on these objects will have verifiers that will run on property change.  I need to capture the verification errors and place them all in a tree view.  I can't run an Instance Verification run every time a property changes so I have to get the errors from each property change.
 
How do you capture the verification error messages when the setters kick off a verification?
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 26-Feb-2010 at 2:26pm
Tim:

You can do this using a VerifierBatchInterceptor. See the section in the Validation Through Verification document (in the Learning Resources) entitled, "Monitor Execution with the VerifierBatchInterceptor".

Each setter will trigger a "batch" of verifier executions (since there can potentially be multiple verifiers triggered by setting any particular property). The interceptor will get called once for each, but has an EndOfBatch flag that gets set to true when a batch is complete.  (Running an instance verification also triggers a single batch of verifier executions.)

The VerifierContext parameter for the VerifierBatchInterceptor delegate will accumulate a collection of VerifierResults for each batch. So you can check in the interceptor to see when EndOfBatch = true, then process the collection of VerifierResults to populate your tree control.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down