I have a table with a datetime
-type column as the version. It's a legacy DB so I can't possibly change it to datetime2
or use a different versioning mechanism. The NHibernate class is mapping this to a DateTime
c# typed property.
I've seen several questions and also forum posts and replies regarding this issue, but regardless of what I've tried, NHibernate keeps truncating the milliseconds off the DateTime value.
Here's what I'm currently doing with Fluent NHibernate:
Version(x => x.ModifiedOn).Column("ModifiedOn")
.CustomType("Timestamp").Not.Nullable();
And in my class that's being mapped, I have:
public virtual System.DateTime ModifiedOn { get; set; }
The database is MS SQL 2008, and Fluent NH is configured as such:
Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString......)
What I need: a working example of how to configure Fluent NH to make NH send datetime values with milliseconds (from what I've seen in the code it should be 10 ms accuracy). Thanks!