title: Using NHibernate (and Fluent NH) to map datetime-type version columns with better than second accuracy (and not truncate milliseconds)
body: <p>I have a table with a <code>datetime</code>-type column as the version. It's a legacy DB so I can't possibly change it to <code>datetime2</code> or use a different versioning mechanism. The NHibernate class is mapping this to a <code>DateTime</code> c# typed property.</p>
  
  <p>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.</p>
  
  <p>Here's what I'm currently doing with Fluent NHibernate:</p>
  
  <pre><code>Version(x =&gt; x.ModifiedOn).Column("ModifiedOn")
                            .CustomType("Timestamp").Not.Nullable();
  </code></pre>
  
  <p>And in my class that's being mapped, I have:</p>
  
  <pre><code>public virtual System.DateTime ModifiedOn { get; set; }
  </code></pre>
  
  <p>The database is MS SQL 2008, and Fluent NH is configured as such:</p>
  
  <pre><code>Fluently.Configure()
          .Database(MsSqlConfiguration.MsSql2008.ConnectionString......)
  </code></pre>
  
  <p>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!</p>