Hi,

I'm trying to understand the best way (and any room for improvement) to
handle timestamps with high resolution running over different database
dialects.

With todays NHibernate, what is the cleanest way to store timestamps with
resolution at least 1ms that will work for both MSSQL and SQLite?


This is the default for a .Net DateTime property:
DateTimeType
/// This only stores down to a second, so if you are looking for the most
accurate
/// date and time storage your provider can give you use the <see
cref="TimestampType" />.


DateTime2Type
Uses DbType.DateTime2 and datetime2 on MS SQL Server. Fails for everything
else it seems, so I cannot cleanly use it in mappings and have it run on
MSSQL in production and SQLite in tests.


TimestampType
Is recommended by DateTimeType if an accuracy greater than 1 second is
required and has the following documentation "stores it to the accuracy the
database supports, and will default to the value of DateTime.Now if the
value is null."

The problem is that I'm not talking about a versioning property here - I
_want_ null values to be stored as null so TimestampType doesn't fit.
Because of this null-handling I think it's a bit strange that this type is
recommended by DateTimeType for high resolution.

Nowadays, the "stores it to the accuracy the database supports" is actually
a lie, because it will round to 10ms on MS SQL Server instead of using the
datetime2 type.


/Oskar

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to