New Posts New Posts RSS Feed: Can Verifiers be Asynchronous?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Can Verifiers be Asynchronous?

 Post Reply Post Reply Page  <12
Author
as123 View Drop Down
Newbie
Newbie


Joined: 27-Apr-2010
Posts: 30
Post Options Post Options   Quote as123 Quote  Post ReplyReply Direct Link To This Post Topic: Can Verifiers be Asynchronous?
    Posted: 14-Dec-2010 at 3:43pm

         For example, let us say Async Check Unique validators are defined for ID and Name properties on Employee. When the Check Unique validation for ID fails, the callback specified will know the context, but how can this context information be passed to the VerifierEngine so that the ID property can be marked as in error (red box around) and show the error message when hovering over the box (as done by InotifyDataErrorInfo).

           In the callback method, if I just create a verifier result how will the Validation Engine know that the error is for ID and not for Name? I was thinking that in this case Target needs to be set to “ID” in the VerifierResult so that it can be marked as in error. Can you please clarify?

 Thanks

 Sample pseudo-code:


ValidatorMethod (…)

{

        …

        /* Async Query to check for duplicate values in the database */

                   EntityManager.ExecuteQueryAsync(query, userCallback, userState)

        …

}

userCallback(…)

{

            …

            _verifierResult = new VerifierResult(_result, message);            

            _currInstance.EntityAspect. ValidationErrors.Add(_verifierResult);

            …

}

Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 14-Dec-2010 at 3:17pm
as123;

The VerifierResult, in this context, is only used to automatically display the errors on the UI. The context is not important in this regard. Maybe I could give a better advice if you can tell me what you're trying to achieve with the TargetInstance and TriggerContext.
Back to Top
as123 View Drop Down
Newbie
Newbie


Joined: 27-Apr-2010
Posts: 30
Post Options Post Options   Quote as123 Quote  Post ReplyReply Direct Link To This Post Posted: 13-Dec-2010 at 10:26am

           Can you please elaborate on the part "you could add the validation error directly to the Entity.EntityAspect.ValidatonErrors collection"? When we add a ‘VerifierResult’ to the ValidatorErrors collection from the callback method specified as part of the InvokeServerMethodAsync call, how to specify the context (targetinstance and triggercontext)? I do not see a VerifierResult constructor taking these properties. Can you please give an example?

 

Thanks

 

Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 15-Nov-2010 at 7:52pm
We don't yet support asynchronous verification, but this is something we're looking at.

The implementation you propose in the last paragraph should work.  Alternatively, after performing your async validation (e.g. through InvokeServerMethod), you could add the validation error directly to the Entity.EntityAspect.ValidationErrors collection and it will be reflected in the UI automatically. In DevForce 6.0.7 (early December) we will support INotifyDataErrorInfo as well as IDataErrorInfo so this should work for both WPF and Silverlight.

Back to Top
mjwolfe View Drop Down
Newbie
Newbie
Avatar

Joined: 28-Oct-2009
Location: CA
Posts: 3
Post Options Post Options   Quote mjwolfe Quote  Post ReplyReply Direct Link To This Post Posted: 12-Nov-2010 at 2:51pm
Does the DevForce 2010 Verification Engine support one of my verifiers executing code that will cause a request to the server that would use a callback when the server-side call returns?
 
The purpose for this would be to get a stored procedure to run that can determine the validity of an instance of my entity based on an operation against a bunch of data in the database. It's too much data to bring it all client-side, but I don't want to wait to fail the save on the server to give the user feedback that I could have told them while they were entering the data on the client.
 
If it's not supported directly, could I implement my own class that holds the results of asynchronous verifiers returned from the server, and then have the callback re-fire the verifier on the associated property and have this new execution of the verifier pick up the results of the previous asynchronous execution to return this time instead of executing the asynchronous method a second time?
 
Thanks.
 
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down