In Entity Framework Core you can specify the built-in conversion.
If you have an enum type
public enum MyEnumType
{
...
}
and a model class with this property
public class EntityWithEnum
{
public MyEnumType MyEnum { get; set; }
...
}
then you can add the built-in conversion
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder
.Entity<EntityWithEnum>()
.Property(d => d.MyEnum)
.HasConversion(new EnumToStringConverter<MyEnumType>());
}
More details here.