NHibernate version: 1.2.0
I just noticed that NHibernate truncates the milliseconds from DateTime properties, even if the underlying database supports them.
The following code in the DateTimeType class implies that this is deliberate:
Code:
public override object Get(IDataReader rs, int index)
{
DateTime dbValue = Convert.ToDateTime(rs[index]);
return new DateTime(dbValue.Year, dbValue.Month, dbValue.Day, dbValue.Hour, dbValue.Minute, dbValue.Second);
}
public override void Set(IDbCommand st, object value, int index)
{
IDataParameter parm = st.Parameters[index] as IDataParameter;
DateTime dateValue = (DateTime) value;
parm.Value =
new DateTime(dateValue.Year, dateValue.Month, dateValue.Day, dateValue.Hour, dateValue.Minute, dateValue.Second);
}
Does anyone know whether was a decision made because some underlying databases may not support the same level of accuracy in DateTime values? It seems a pity to lose DateTime resolution if your DB can support it...
Cheers,
Symon.