New Posts New Posts RSS Feed: Data Validation (TriggerMemberName) Issue
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Data Validation (TriggerMemberName) Issue

 Post Reply Post Reply
Author
tscott View Drop Down
Newbie
Newbie
Avatar

Joined: 25-Oct-2010
Posts: 2
Post Options Post Options   Quote tscott Quote  Post ReplyReply Direct Link To This Post Topic: Data Validation (TriggerMemberName) Issue
    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. 
Back to Top
tscott View Drop Down
Newbie
Newbie
Avatar

Joined: 25-Oct-2010
Posts: 2
Post Options Post Options   Quote tscott Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down