I am using the Ent Lib 3.0 configuration console to configure VAB in my class library. I am applying the standard Range Validator onto an Integer property.
I pointed the console to open my executable's App.Config to configure it and I am configuring this integer to have a range between 8 and 40 both using InInclusive bound type.
When I asked the console to validate it (Ctrl-Shift-V), it complains of an error:
"The value for UpperBound should be greater than the value for LowerBound."
That's odd! To me 40 > 8.
A bit of experiment suggests to me that the console simply using String.Compare(upperBound, lowerBound) > 0. In this case, String.Compare( "40", "8" ) < 0 but String.Compare( "40", "3" ) > 0.
So the console does not appear to inspect the property for the data type, convert the lower and upper string values to that type and then check the specification to determine is it valid.
Just to demonstrate that the validator works in runtime, I enter some rubbish to allow the configuration console to save the specification to the App.Config build the program can then use the Validation.ValidateFromConfiguration<>() to validate.
Prior to running the program, I modify the config file to contain the range 8 to 40 as follows:
<type assemblyName="DemoClassLib, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null" name="DemoClassLib.Person">
<validator lowerBound="8" lowerBoundType="Inclusive" upperBound="40" upperBoundType="Inclusive" negated="false" messageTemplate="Not acceptable age" messageTemplateResourceName="" messageTemplateResourceType="" tag="" type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeValidator,
Microsoft.Practices.EnterpriseLibrary.Validation, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Range Validator" />
It runs properly and validating according to the rule prescribed above.
Can someone please tell me how to configure ranges in the Configuration console without having to manually editing the config file?
Or could this be a bug?
Same issue in Ent Lib 3.1.
This forum is for CodePlex web site issues and discussion only. Please re-post your question in the appropriate project's forums.
I have downloaded and started using enterprise library 3.1. Seems to be making my task easy. Now my question is related to the configuration file. what is the meaning of Publictoken Key in the following line
Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Also is it unique value for library 3.1 and required. Initially I had a null value as copied from MSDN and it did not work. Then I copied the above mentioned value and things started working I mean connection to database was established. So what is this and
how I determine that this value is correct.