title: Can't save negative decimal values
body: <p>I'm working with Entity Framework code first. The error occurs when trying to save a negative decimal value into the SQL Server database. The model that I'm trying to save is listed below. </p>
  
  <pre><code>public class Material
  {
          public Material()
          {
              Categories = new List&lt;Category&gt;();
          }
  
          [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
          public Guid Id { get; set; }
          [Required]
          public string Name { get; set; }
          public string Description { get; set; }
          [Required]
          public DateTime Taken { get; set; }
          public decimal? Latitude { get; set; }
          public decimal? Longitude { get; set; }
          public virtual ICollection&lt;Category&gt; Categories { get; set; }
      }
  </code></pre>
  
  <p>Here I'm trying to set the precision of the decimal (Latitude/Longitude) in the model Material.</p>
  
  <pre><code> protected override void OnModelCreating(DbModelBuilder modelBuilder)
   {
          modelBuilder.Entity&lt;Material&gt;().Property(x =&gt; x.Latitude).HasPrecision(8, 7);
          modelBuilder.Entity&lt;Material&gt;().Property(x =&gt; x.Longitude).HasPrecision(8, 7);
   }
  </code></pre>
  
  <p>In the database the column information looks like this: </p>
  
  <pre><code>dbo.Materials.Latitude (decimal(8, 6), null)
  
  dbo.Materials.Longitude (decimal(8, 6), null)
  </code></pre>
  
  <p>If I try to save a negative value like <code>-1m</code> everything works fine. But as soon is I try to save any bigger value or value with decimals like <code>-123</code> or <code>-123.123456</code> the data context always throws an exception when saving. </p>
  
  <p>The exception I'm getting is this: </p>
  
  <blockquote>
    <p>An error occurred while saving entities that do not expose foreign key
    properties for their relationships. The EntityEntries property will
    return null because a single entity cannot be identified as the source
    of the exception. Handling of exceptions while saving can be made
    easier by exposing foreign key properties in your entity types. See
    the InnerException for details.</p>
  </blockquote>
  
  <p>Looking in to the inner exception we can see that this might be the cause of the problem: </p>
  
  <blockquote>
    <p>{"Parameter value '-117.246108' is out of range."}</p>
  </blockquote>
  
  <p>How can I solve this problem ? </p>