1
我在我的UWP项目中使用SQLite。 我的模型类有日期时间字段:在C#中的日期时间SQLite bigint
public class EducationInfo
{
[SQLite.Net.Attributes.PrimaryKey, SQLite.Net.Attributes.AutoIncrement]
public int educationInfoId { get; set; }
public String Education { get; set; }
public bool Enabled { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public int UserId { get; set; }
// Not in the DB
[Ignore]
public string FormattedStartDate { get; set; }
[Ignore]
public string FormattedEndDate { get; set; }
public EducationInfo()
{}
public EducationInfo(String edu, bool enabled, DateTime st, DateTime ed, int userId)
{
this.Education = edu;
this.Enabled = enabled;
this.StartDate = st;
this.EndDate = ed;
this.UserId = userId;
}
}
的问题是,SQLite的创建日期时间字段为BIGINT。我如何阅读这个bigint并设置为DateTime?
`
var education = connection.Table<EducationInfo>().Where(e => e.UserId == user.userID);
foreach(var edu in education)
{
EducationInfo educationInfo = new EducationInfo();
educationInfo.StartDate = edu.StartDate;
}
上面的代码不会返回错误,但日期值是错误的。 '
哪个ORM您使用的? – Dai
这是SQLite.NET-PCL – user6824563