I have a model that contains 3 properties:
public class SomeModel
{
[Key]
public int SomeInt { get; set; }
public string SomeString { get; set; }
public TimeSpan Time { get; set; }
}
If I try to add such a model to my SQLite Database an exception is thrown.
using (var db = new MyDataContext())
{
var item = new SomeModel { SomeInt = 123, SomeString = "a string" , Time = new TimeSpan(1,2,3)};
db.SomeModels.Add(item);
try
{
db.SaveChanges();
}
catch (Exception ex)
{
Console.WriteLine(ex);
Console.ReadLine();
throw;
}
}
The Exception:
System.NotSupportedException: "There is no store type corresponding to the EDM type 'Edm.Time' of primitive type 'Time'."
Is there any way to add this model to the database?