Thursday, January 27, 2011

Date/Time Support in NHibernate

In this post, we’ll examine the ways that NHibernate supports the DateTime-related data types, including some new features introduced in NHibernate 2 and 3. Here is a quick summary for the impatient.


DbType.NETSQL Type
DateTimeSystem.DateTimedatetime
LocalDateTimeSystem.DateTimedatetime
UtcDateTimeSystem.DateTimedatetime
DateTimeOffsetSystem.DateTimeOffsetdatetimeoffset
DateTime2System.DateTimedatetime2
DateSystem.DateTimedate
TimeSystem.DateTimetime
TimeAsTimeSpanSystem.TimeSpantime
TimeSpanSystem.TimeSpanbigint (int64)

Let’s take a look at a few DateTime-related problems that developers have run into in the past…

Read more: James Kovacs' Weblog