I have a class which is also a table of a database SQLite.
I need to work with dates and I thought the best solution was to work with dates as integers, since in sqlite i don't have date operations. The problem is the following: I'm saving DateTime in my db as int using as helper a DateTime parameters which is ignored by db.
This is my class:
public class MYCLASS : Shared
{
[PrimaryKey]
public Guid ID { get; set; }
[Ignore]
public DateTime DATA_ORA
{
get { return DateTime.Parse(this.DATA_ORA_INT.ToString()); }
set { this.DATA_ORA_INT = int.Parse(value.ToString("yyyyMMdd")); }
}
private int DATA_ORA_INT { get; set;}
}
I'm having the app terminating without any exception when I set the DATA_ORA field. Why this code is not working?
EDIT:
this is when I got the crush:
MYCLASS transazione = new MYCLASS
{
ID = Guid.NewGuid(),
DATA_ORA = DateTime.Now
};
Aucun commentaire:
Enregistrer un commentaire