检查此代码片段。
using (AttendanceDataContext db = new AttendanceDataContext())
{
var attendance = db.attendpunches.Select(at => new RawEmployeeCheckInOutInfo
{
CheckTime = at.punchtime.Value,
Direction = ((AttendanceDirection)at.direction.Value).ToString()
});
...
AttendanceDirection 是枚举,它是...
public enum AttendanceDirection : int
{
CheckIn = 1,
CheckOut = 2
}
问题是 Direction = ((AttendanceDirection)at.direction.Value).ToString() 总是返回字节值。