Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 496503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:41:32+00:00 2026-05-13T05:41:32+00:00

Has anyone used the validation application block from enterprise library? Any success? Anyways, my

  • 0

Has anyone used the validation application block from enterprise library? Any success?

Anyways, my question is with regards to validating a numeric unique identifier. Lets say I have a Product class, with a ProductId property representing the unique identifier of the product. It is numeric. This identifier cannot be less than 1, it has to be greater than 1. I do not what validation type to choose using the validation application block. I was thinking of trying the range type, but it requires 2 values, a lower and an upper value.

Another question to validating business object properties. Is this the best way to test business objects? I want to specify validation rules just once, then I want to use them across different layers, like ASP.NET. I have never validated business objects this way, just on the client side. Can someone please tell me what is the best route to go with and if I am in the right direction?

Can someone advise?

Thanks
Brendan

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:41:33+00:00Added an answer on May 13, 2026 at 5:41 am

    VAB Experience

    I have used the VAB to on projects for validation. I would say that it is good. I wouldn’t go so far as to say it’s great. No major issues so far. What I did find was that we did need to create some custom validators because our needs were not addressed out of the box. So it’s extensible which is good. We did have issues with the configuration tool not being able to resolve our types (I think it’s a bug in loading dependencies). The code runs fine but we had to do some configuration without the tool.

    Validating a Numeric Unique Identifier

    You’re on the right track with the range validator. Be aware that each range (upper and lower) can have 3 different types: Inclusive, Exclusive and Ignore. This should cover most cases. In your case, you can specify the upper bound as ignore with the lower bound as 1 inclusive (assuming you want ProductId to be 1 or greater).

    In configuration this would look like:

       <properties>
          <property name="ProductId">
            <validator lowerBound="1" lowerBoundType="Inclusive" upperBound="0"
              upperBoundType="Ignore" negated="false" messageTemplate="Oops...too low." messageTemplateResourceName=""
              messageTemplateResourceType="" tag="" type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
              name="Range Validator" />
          </property>
        </properties>
    

    Validating Business Object Properties

    It sounds like you are on the right track. You should definitely always validate input to your business (or service) layer. If you also want to perform validation in the client tier then you can share your configuration or entities (business objects is what you called them) across tiers but you will have to ensure that the config or entities are synchronized between tiers. Another thing to consider if you are validating in two different tiers is how the ValidationResults will be displayed. VAB has integration with ASP.NET but once you call the business tier you won’t have that integration so you will need another (custom) way to display those errors. (That may be as simple as a Label to dump the errors to.)

    Now you’re saying: ah, but if I validate in the web tier then I should catch all of the validation errors in ASP.NET and it all works nicely together. True. But that brings me to my last point.

    VAB may be able to handle all validation but it probably won’t be able to handle complicated validations. VAB is not going to do well if you have cross field (or cross object) validations. Also, you may need some custom validation in your business tier that you don’t want to execute in the web tier (e.g. perhaps some validation depends on databases or external services that are not accessible from the web tier). So it’s possible that you might end up with two different implementations to display validation/error messages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone used a Java based library for generating excel documents? Preferably support for
Has anyone used Robotium or Calculon for testing Android apps? Are they useful? Any
Has any one used data validation on fields that are optional (nullable types)? I.e.
Has anyone used CSLA in an application that has a WPF front end and
Has anyone used the FileSystemWatcher in framework 4 and have you encountered any problems?
Has anyone used Google App Engine with a HPC application? is it possible to
Has anyone used Akamai's EdgeCache in front of a Django-based application? Is there anything
Has anyone used Hazelcast (preferably 2.1) with play framework 2.0/2.1 (not 1.2+)? I am
Has anyone used both Joone and Encog in production applications? Is there something you
Has anyone used this plugin? I don't know if my setup is right, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.