How can I use NpgsqlInterval in Entity Framework 6.1, Code First?
With this code I get a System.InvalidOperationException as soon as my program tries to access an instance of class "Feldtest":
public class Feldtest
{
public int FID { get; set; }
... other properties
public NpgsqlInterval Abstand { get; set; }
}
Exception:
System.InvalidOperationException wurde nicht behandelt.
HResult=-
2146233079
Message=The property 'Abstand' is not a declared property on type 'Feldtest'. Verify that the property has not been explicitly excluded from the model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property.
Source=EntityFramework
...
I can't use a TimeSpan property, because it falsifies the data (30 days instead of 1 month, 360 days instead of 1 year etc.). I could quite well use the string representation, but I don't know how to write my class to do that.
Thank you for help!