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
- Fixed the #400 and #402. Will be available at v1.10.11-beta2. — committed to mikependon/RepoDB by mikependon 4 years ago
- Fixes for (https://github.com/mikependon/RepoDb/issues/400) and (https://github.com/mikependon/RepoDb/issues/402). — committed to mikependon/RepoDB.NET by mikependon 4 years ago
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.