jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nullable enum not working

MoeHamdan opened this issue · comments

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"

This is fixed in 6.2.1 (thanks @Powerz).

Posting a build soon.