title: Decimal fields truncated with NHibernate 3.2 and FluentNHibernate 1.3
body: <p>I have a case where decimal fields are being truncated to five decimal places when saving to the database.  This happens even though I have mapped them with a precision of 10 places after the decimal.</p>
  
  <p>I’m using NHibernate 3.2.0.4000 and FluentNHibernate 1.3.0.717 with SQL Server 2008.</p>
  
  <p>Here is my C# property:</p>
  
  <pre><code>public virtual decimal? MyDecimalField { get; set; }
  </code></pre>
  
  <p>I’ve tried doing an auto mapping override:</p>
  
  <pre><code>mapping.Map(x =&gt; x.MyDecimalField).Precision(28).Scale(10);
  </code></pre>
  
  <p>I’ve also tried doing explicit mapping of the field:</p>
  
  <pre><code>Map(x =&gt; x.MyDecimalField).Precision(28).Scale(10);
  </code></pre>
  
  <p>When doing a schema export, the table gets created correctly:</p>
  
  <pre><code>create table MyTable (
      Id UNIQUEIDENTIFIER not null,
     MyDecimalField DECIMAL(28, 10) null,
     primary key (Id)
  )
  </code></pre>
  
  <p>Using a value of 5.1234567890, here are snippets of parameters from the generated SQL update statement:</p>
  
  <pre><code>@p31 decimal(28,5)
  @p31=5.12345
  </code></pre>
  
  <p>I am able to make this work correctly if I use XML mapping:</p>
  
  <pre><code>&lt;property name="Decimal01" precision="28" scale="10"/&gt;
  </code></pre>
  
  <p>I have removed all conventions for decimal fields and still have the problem.</p>
  
  <p>Since XML based mapping works, this leads me to believe that it is a problem with Fluent.  Any suggestions on something else I may have missed?</p>
  
  <p>Thanks,
  Skip</p>