Print Page | Close Window

DelegateVerifier ...

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=2330
Printed Date: 23-Jan-2026 at 9:46pm


Topic: DelegateVerifier ...
Posted By: as123
Subject: DelegateVerifier ...
Date Posted: 22-Nov-2010 at 11:26pm
      When creating a DelegateVerifier with only errorMessage and Condition, the verifier has the ApplicableType set  correctly (checked while debugging) in the trigger link after doing AddTrigger. However, when using the constructor with 4 parameters, the trigger is added successfuly, but the TriggerItem.Type is set to null. Due to this, I believe, the validation is not fired on SetItem. 

      Can someone tell me how to resolve this? Do I need to set anything else before creating DelegateVerifier with 4 parameters so that the Applicable Type is set correctly?

Thanks

----------------------------------------------------------------------------------------------------------------------------------
Sample code:

      string errorMessage;
           
// works ok
    DelegateVerifier<Employee> v = new DelegateVerifier<Employee>(errorMessage, Condition); //Condition is a method name

// does not work
    //DelegateVerifier<Employee> v = new DelegateVerifier<Employee>(verifierArgs, errorMessage, null, Condition);                                                                             //veriferArgs - created using the default constructor and its Tag set to a custom object;

     v.AddTriggers("ID");  



Replies:
Posted By: DenisK
Date Posted: 29-Nov-2010 at 5:10pm
Hi as123;

To use the DelegateVerifier constructor with the 4 parameters, you can use the following:

var verifierArgs = new DelegateVerifierArgs<Employee>(errorMessage, null, Condition);
DelegateVerifier<Employee> v = new DelegateVerifier<Employee>(verifierArgs, errorMessage, null, Condition);

If that sounds redundant, then you can also use:

DelegateVerifier<Employee> v = new DelegateVerifier<Employee>(verifierArgs);


Posted By: as123
Date Posted: 30-Nov-2010 at 12:48pm
         Thanks.



Print Page | Close Window