Skip to main content
.NET Framework 4.6.2+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.v24.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 virtual string FileName { get; set; }
    // ...
    [Browsable(false)]
    public bool IsEmpty {
        get { return string.IsNullOrEmpty(FileName); }
    }
}

// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.

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 virtual FileData File { get; set; }
    // ...
}

// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.
See Also