I have a model with a property of type enum. In the database I want to store not the enum value number and the value itself as a string. And when using EF Core FirstOrDefault I get the value from the database I want to convert the string to an enum. I think it can be done with attributes but I don't understand how to do it. I hope I wrote clearly
public enum MyEnum
{
    value1,
    value2,
    value3
}   
public class MyClass
{
    public int Id;  
    public MyEnum myEnum; //in the database the string "value2". Now of course it's a mistake. Need to convert from string to enum value
}
var myClass = context.MyClases.FirstOrDefault(x => x.Id == Id);
 
     
    