Define Date type in OrmLite model

Is it possible to define the PostgreSQl Date type in an OrmLite model?

For instance this model:

public class DateTest
    public int Id { get; set; }
    public DateTime TestDate { get; set; }

TestDate gets created as a timestamp when using db.CreateTable<DateTest>(); but if I manually create the table using the Date column type it seems to work fine and truncates time data which is what I want.

Do I have to manually create the column or can I specify this column type in the model?

You can use the [CustomField] attribute to provide a Custom Field Declaration.

1 Like