EF - mapping DateTime to 'date' type in Postgres
Hello,
Entity Frameworks maps
DateTime
to timestamp with time zone
in Postgres, but how could I map it to date
type?4 Replies
Are you using a recent enough .NET to use DateOnly?
I am using .NET 8, so I guess
you can override what backing type is used on a property level in the configuration (IEntityConfigurationType please), but yeah, if you want it to map to
date
, you should probably use DateOnly
Got it, thank you both. The ReadOnly type is more elegant