DateTime to Date/Time

DateTime to Date/Time

Postby rogerio.bassete » Fri 23 Mar 2012 11:32


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

Is possible in Code First?
Posts: 15
Joined: Sat 05 Aug 2006 20:55
Location: Brazil

Postby 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: ... e(v=vs.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

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
Devart Team
Posts: 7889
Joined: Thu 14 Aug 2008 12:44

Return to dotConnect for PostgreSQL