Page 1 of 1

DateTime2 support for 3 different databases

Posted: Mon 13 Jul 2015 16:34
by INDI03
Hello!

We are currently creating SQLServer, Postgres and SQLite databases from one Model.
Unfortunatly SQLite does not support DateTime2 type.
As a workaround we did the folling in the model:
[Column(TypeName = "Date")]
public DateTime DatePictureTaken { get; set; }
This works, but off course now it does not show the time but only the date.
Any suggestions?

Kind regards, Oliver

Re: DateTime2 support for 3 different databases

Posted: Thu 16 Jul 2015 09:04
by Shalex
1. We recommend you to implement fluent (instead of attribute) mapping. This will allow setting the target database, model created for, and needed database-specific data type.

2. For SQLite, please use the datetime (instead of date) database type which corresponds to System.DateTime .NET type: https://www.devart.com/dotconnect/sqlit ... pping.html.