Back to Devexpress

RuleBaseAttribute.SkipNullOrEmptyValues Property

expressappframework-devexpress-dot-persistent-dot-validation-dot-rulebaseattribute-e617cd00.md

latest2.6 KB
Original Source

RuleBaseAttribute.SkipNullOrEmptyValues Property

Specifies whether the current rule is checked for the properties that are set to null, an empty string (for string type propeties) or a minimal date (for DateTime type properties).

Namespace : DevExpress.Persistent.Validation

Assembly : DevExpress.Persistent.Base.v25.2.dll

NuGet Package : DevExpress.Persistent.Base

Declaration

csharp
public bool SkipNullOrEmptyValues { get; set; }
vb
Public Property SkipNullOrEmptyValues As Boolean

Property Value

TypeDescription
Boolean

true if null-like values are not checked by the current rule; otherwise, false.

|

Remarks

When defining a rule, you can specify whether to consider the properties that are set to null, an empty string (for string type propeties) or a minimal date (for DateTime type properties) when checking the rule. To set the required behavior for a rule that is defined via a validation attribute, use the named SkipNullOrEmptyValues parameter.

csharp
[RuleUniqueValue(DefaultContexts.Save, SkipNullOrEmptyValues = false)]
public string UniqueValue { 
   //...
}

By default, SkipNullOrEmptyValues is set to false in the RuleRequiredField rule; in the remaning validation rules, it is set to true.

The SkipNullOrEmptyValues behavior specified for a validation rule in code is set for the SkipNullOrEmptyValues property of the Application Model’s IModelRuleBase node. So, you can change this behavior directly in the Model Editor.

Implements

SkipNullOrEmptyValues

See Also

RuleBaseAttribute Class

RuleBaseAttribute Members

DevExpress.Persistent.Validation Namespace