title: Entity Framework Core - setting the decimal precision and scale to all decimal properties
body: <p>I want to set the precision of all the decimal properties to (18,6). In EF6 this was quite easy:</p>
  
  <pre><code>modelBuilder.Properties&lt;decimal&gt;().Configure(x =&gt; x.HasPrecision(18, 6));
  </code></pre>
  
  <p>but I can't seem to find anything similar to this in EF Core. Removing the cascade delete convention wasn't as simple as in EF6 so I found the following workaround:</p>
  
  <p>EF6:</p>
  
  <pre><code>modelBuilder.Conventions.Remove&lt;ManyToManyCascadeDeleteConvention&gt;();
  modelBuilder.Conventions.Remove&lt;OneToManyCascadeDeleteConvention&gt;();
  </code></pre>
  
  <p>EF Core:</p>
  
  <pre><code>foreach (var relationship in modelBuilder.Model.GetEntityTypes().SelectMany(e =&gt; e.GetForeignKeys()))
      relationship.DeleteBehavior = DeleteBehavior.Restrict;
  </code></pre>
  
  <p>and after I read <a href="https://stackoverflow.com/questions/30388695/entity-framework-7-set-decimal-precision-for-model-builder">this</a>, I tried a similar approach:</p>
  
  <pre><code>foreach (var entityType in modelBuilder.Model.GetEntityTypes()
      .SelectMany(x =&gt; x.GetProperties())
      .Where(x =&gt; x.ClrType == typeof(decimal)))
          {
              // what to do here?
          }
  </code></pre>
  
  <p>I would like if I am on the right track and how to continue, or if not, should I start putting data annotations on all the <code>decimal</code> properties.</p>