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