I am using nHibernate + FluentNHibernate with SQLite database.
All dates are stored as text in format ‘YYYY-MM-DD HH:MM:SS’
How can I instruct nHibernate (or sqlite driver???) to truncate time part and store date in ‘YYYY-MM-DD’ format for certain fields (and storing the full date for other fields) ?
Or how can I instruct to store all dates as integers ?
I am concerned on space usage, because dates takes a lot of space in the database and there are indexes on dates too, so I need to make them taking as less space as possible.
If you convert
DateTimetoStringmanually, I can’t see any problem to replace string format byYYYY-MM-DD.If you let NHibernate to perform this conversion, then you could create custom NHibernate
UserTypelike so:And map your
DateTimeproperty using eitherTruncatedDateTimeAsStringTypeorFullDateTimeAsStringType: