DateTime to Date/Time

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
rogerio.bassete
Posts: 15
Joined: Sat 05 Aug 2006 20:55
Location: Brazil

DateTime to Date/Time

Post by rogerio.bassete » Fri 23 Mar 2012 11:32

Hi,

I like maping .net DateTime to Date and DateTime to Time.

Is possible in Code First?

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

Post by Shalex » Mon 26 Mar 2012 16:41

rogerio.bassete wrote:DateTime to Time
It is better to map TimeSpan to Time.
rogerio.bassete wrote:DateTime to Date
As we understood, you want to specify the server data type for the DateTime column. This can be done with ColumnAttribute (the TypeName property: http://msdn.microsoft.com/en-us/library ... .103).aspx ) or, in case of fluent mapping, with the .HasColumnType(string columnType) method of property configuration (an example of application with fluent mapping and detailed description of Code-First peculiarities is available at http://www.devart.com/blogs/dotconnect/ ... qlite.html).

If you already have a database schema and you want just to map classes to it, the easier way to proceed is to create a Code-First model basing on the existing database with http://www.devart.com/blogs/dotconnect/ ... plate.html.

Post Reply