title: Set decimal precision for query result object
body: <p>I have a class supplied to me via Nuget. I don't have the source.</p>
  
  <pre><code> public class SpecialProductResult
    {
      public int id { get; set; }
      public decimal SpecialPercent {get;set;}
    }
  </code></pre>
  
  <p>I want to populate a list of SpecialProductResult from a stored procedure</p>
  
  <p>So in my DbContext I have</p>
  
  <pre><code>public DbQuery&lt;SpecialProductDto&gt; SpecialProducts { get; set; }
  </code></pre>
  
  <p>I populate the list using</p>
  
  <pre><code>var specialProducts =   connect.SpecialProducts.FromSql("spGetSpecialProducts").ToList()
  </code></pre>
  
  <p>In the error log I see messages like</p>
  
  <blockquote>
    <p>No type was specified for the decimal column ‘“SpecialPercent”’ on entity
    type ‘“SpecialProductResult”’. This will cause values to be silently
    truncated if they do not fit in the default precision and scale.
    Explicitly specify the SQL server column type that can accommodate all
    the values using ‘ForHasColumnType()’.</p>
  </blockquote>
  
  <p>I looked at <a href="https://stackoverflow.com/questions/3504660/decimal-precision-and-scale-in-ef-code-first">this question</a> and wanted to try</p>
  
  <pre><code>modelBuilder.Entity&lt;SpecialProductResult&gt;().Property(o =&gt; o.GoldPercent).HasPrecision(18,4)
  </code></pre>
  
  <p>But there is no property .HasPrecision</p>
  
  <p>What should I try?</p>
  
  <p>[Update]</p>
  
  <p>I tried Ivan Stoev's answer but received a runtime error</p>
  
  <pre><code>The entity type 'SpecialProductResult' cannot be added to the model because a query type with the same name already exists
  </code></pre>