jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM
Other
861 stars 145 forks source link

Nullable enum not working #364

Closed MoeHamdan closed 6 years ago

MoeHamdan commented 6 years ago

Type

What kind of issue is this?

[X ] Bug report.
[ ] Feature request.

Current Behavior

When having a Nullable enum as property in a class it will not be mapped.

Expected behavior

It should be mapped correctly.

Steps to Reproduce

` public class Employee { public int EmployeeId { set; get; } public string EmpNo { set; get; } public string FirstName { set; get; } public string LastName { set; get; } public string PreferredName { set; get; } public DateTime? DateOfBirth { set; get; } public Gender? Gender { set; get; } public DateTime HiredDate { get; set; } public DateTime? Terminated { set; get; } public bool IsFieldStaff { get; set; } public bool IsAvailableForEmergencyPlacement { set; get; } public bool IsTrainee { set; get; } }

public enum Gender
{
    Male,
    Female,
    Nothing
}

` Try using something similar to the above class you will notice that it will not fill the Gender correctly.

Any other comment

This issue happens when the value returned from the database is string "Female", "Male"

jonwagner commented 6 years ago

This is fixed in 6.2.1 (thanks @Powerz).

Posting a build soon.