Print Page | Close Window

Data Validation (TriggerMemberName) Issue

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2260
Printed Date: 24-May-2025 at 11:37am


Topic: Data Validation (TriggerMemberName) Issue
Posted By: tscott
Subject: Data Validation (TriggerMemberName) Issue
Date Posted: 25-Oct-2010 at 1:49pm
Hi,
 
I am new to DevForce and have been struggling for a few days to understand the verification engine and some help. When validation is triggered in the UI the TriggerMemberName property of the VerifierResult gets set to the property name for which the validation relates. However, if you call aVerifierEngine.Execute(aObject) the TriggerMemberName does not get set and that is the problem. I am using Devforce 6.0.6 and generated a default app using the Devforce Silverlight Business Application Template. 
 
Any and all help appreciated, Thanks. 



Replies:
Posted By: tscott
Date Posted: 17-Nov-2010 at 3:47pm

Can anyone help?

My problem is this...

I am attempting to perform Instatnce verification on a object which uses verifiers. Here is the code i'm using to perform the verification:

        [Bindable(false)]
        [Display(AutoGenerateField = false)]
        public bool Validate()
        {
            // Verify entity.
            var results = VerifierEngine.Execute(this);
 
            return results.Ok;
            ;
        }
All is well and I can see that the verifiers are working correctly. I would like to be able to identify which properties fail verification so that I can raise a ErrorsChanged event for each property.
The problem is that when using instance verification I cannot discover the TriggerMemberName or property names using:

var members = errors.Errors.Select(vr => vr.TriggerMemberName).Distinct()

as this information is not captured when you call VerifierEngine.Execute(this)

Any way around this, what should I be doing instead? Thanks



Posted By: kimj
Date Posted: 17-Nov-2010 at 7:50pm

Sorry we missed your earlier post.

The ErrorsChanged event is actually already fired by DevForce during an instance verification.  But if it's not working correctly for you, you can call GetErrors(propertyName) to retrieve the validation errors specific to a property.  Both ErrorsChanged and GetErrors are available via explicit implementation of the INotifyDataErrorInfo interface on the EntityWrapper, so you can cast to the interface to access these members:
   var inde = this as INotifyDataErrorInfo;
 
In release 6.0.7 coming next month the PropertyNames will also be available on the VerifierResult, so you'll have this available even when a TriggerMemberName isn't set.
 



Print Page | Close Window