RepoDB: Bug PropertyHandler for Nullable Enum

public enum Hands
{
        Left,
        Right
 }

public class HandPropertyHandler : IPropertyHandler<string, Hands?>
{
        public Hands? Get(string input, ClassProperty property)
        {
            // Transformation back to class
            return Hands.Left;
        }

        public string Set(Hands? input, ClassProperty property)
        {
            // Transformation towards the database
            return Hands.Left.ToString();
        }
 }

public class Person
 {
        public int Id { get; set; }

        [PropertyHandler(typeof(HandPropertyHandler))]
        public Hands? Hand { get; set; }
 }

 Person newPerson= new Person();
int id = connection.Insert<Person, int>(newPerson);

result in Exception ‘No coercion operator is defined between types ‘System.String’ and ‘System.Nullable`1[RepodbTest.Hands]’.’

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I have have tried by droping the table but it’s same result. I know that I don’t need the handler but It was a workaround for #401, it’s the same without the handler.

Yes no problem. Thank you very much Michael.