Skip to main content
.NET 8.0+

DevExpress v25.1 Update — Your Feedback Matters

Our What's New in v25.1 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

Enumeration Properties in EF Core

The example below illustrates how to implement Enumeration Properties in an EF Core Code-First class.

public virtual TextOnlyEnum TextOnlyEnumProperty { get; set; }
public virtual TextAndImageEnum TextAndImageEnumProperty { get; set; }
// ...
public enum TextOnlyEnum { Minor, Moderate, Severe }
public enum TextAndImageEnum {
    [ImageName("State_Priority_Low")]
    Low,
    [ImageName("State_Priority_Normal")]
    Normal,
    [ImageName("State_Priority_High")]
    High 
}

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

To be able to use this enumeration type in design-time criteria editors, register it in the constructor of your ModuleBase descendant using the EnumProcessingHelper.RegisterEnum method as follows.

using DevExpress.Data.Filtering;
//...
public sealed partial class MySolutionModule : ModuleBase {
    public MySolutionModule() {
        InitializeComponent();
        EnumProcessingHelper.RegisterEnum(typeof(MySolution.Module.BusinessObjects.MyClass.TextOnlyEnum));
        //...
    }
    //...
}
See Also