This project is read-only.
1

Closed

Errorlist

description

I've declared a validatorattribute on a property in my custom class

private string name;
    [NotNullValidator()]
    [StringLengthValidator(AllowNulls = false, Min = 1, Max = 3)]
    public string Name
    {
        get { return name; }
        set { Set(ref name, value, "Name"); }
    }
Also I've defined a custom validator using the following....

public override string this[string columnName]
    {
        get
        {
            string result = base[columnName];

            if (columnName == "Name")
            {
                if (name == "MyName")
                    result = result.AddLine("Name cannot be MyName");
            }

            return result;
        }
    }
So i've two validation rules on the property "Name". In the WPF UI there is a error control displaying
the number of errors. It seems to me that the error count is not always right.
Closed Nov 30, 2009 at 4:23 PM by

comments

Olmo wrote Mar 11, 2009 at 1:43 PM

You have three validations taking place, NotNullValidator, StringLengthValidator and your custom one. Try removing NotNullValidator.

We usually don't use NotNullValidator with strings, because TextBox interchanges null and "" randomly.

Also, it's a good practice to allow custom Validators to run on null values (just returning).

antonioh wrote Mar 23, 2009 at 3:47 PM

** Closed by antonioh 3/16/2009 4:25 AM

Olmo wrote Mar 23, 2009 at 3:47 PM

Bug found

Olmo wrote Mar 23, 2009 at 3:52 PM

Actually we have found a BUG in Signum Windows 1.0 related to this issue. Sometimes all the Validations get duplicated.

It's fixed now, and will be released in the next version