Up Validation code samples
DevForce Resource Center » Samples » Validation code samples » Code sample: Validation support files

Code sample: Validation support files

Last modified on September 20, 2012 11:11

The sample download includes validation support files showing how verifiers can be defined in a configuration file and the fallback validation resource file.


Problem

You'd like a sample showing how verifiers can be defined in a configuration file, or the resource file used for validation error messages.

Solution

The download includes the following:

  1. An app.config showing the <verifiers> section of the ideablade.configuration with a few verifiers defined.  If you define verifiers in a configuration file you must call DiscoverVerifiersFromConfig to load the verifiers.
    C#
    var manager = new NorthwindIBEntityManager();
    manager.VerifierEngine.DiscoverVerifiersFromConfig();
    VB
    Dim manager = New NorthwindIBEntityManager()
    manager.VerifierEngine.DiscoverVerifiersFromConfig()
  1. The VerifierErrorsResource.resx file used by DevForce validation.  You can modify this resource file to localize or modify the standard validation error messages.  Set the ErrorsResourceManager to your custom resource file:
    C#
    var manager = new NorthwindIBEntityManager();
    manager.VerifierEngine.ErrorsResourceManager = MyErrorMessages.ResourceManager;
    VB
    Dim manager = New NorthwindIBEntityManager()
    manager.VerifierEngine.ErrorsResourceManager = MyErrorMessages.ResourceManager

    If you set the ErrorsResourceManager, the DevForce-supplied VerifierErrorsResource file is used as a fallback.

Created by DevForce on May 05, 2011 14:04

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2020 IdeaBlade