Skip to main content
A newer version of this page is available. .

IEmptyCheckable.IsEmpty Property

Gets if the IEmptyCheckable value is considered to be empty when validating via the RuleRequiredFieldAttribute.

Namespace: DevExpress.Persistent.Validation

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

Declaration

bool IsEmpty { get; }

Property Value

Type Description
Boolean

true, when the value is empty; otherwise, false.

Remarks

Support the IEmptyCheckable interface and implement the IsEmpty method, when it is required to validate properties of your custom type via the RuleRequiredField attribute. Below is the snippet from the Business Class Library’s FileData class, illustrating the implementation of this property:

public class FileData : BaseObject, IFileData, IEmptyCheckable {
    // ...
    public string FileName {
        get { return fileName; }
        set {
            SetPropertyValue<string>("FileName", ref fileName, value);
        }
    }
    // ...
    [NonPersistent, MemberDesignTimeVisibility(false)]
    public bool IsEmpty {
        get { return string.IsNullOrEmpty(FileName); }
    }
}

With the IEmptyCheckable interface supported, the property of the FileData type can be validated in the following manner:

public class Resume : BaseObject {
     // ...
    [RuleRequiredField("RuleRequiredField for Resume.FileData", 
        DefaultContexts.Save, ,"The file must be specified"]
    public FileData File {
        // ...
    }
    // ...
}
See Also