DateTime2 support for 3 different databases

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
INDI03
Posts: 5
Joined: Mon 23 Feb 2015 14:57

DateTime2 support for 3 different databases

Post by INDI03 » Mon 13 Jul 2015 16:34

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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: DateTime2 support for 3 different databases

Post by Shalex » Thu 16 Jul 2015 09:04

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.

Post Reply