title: EF Core ignores some of my mapping configuration
body: <p>I have a class for my model and another class for mapping models with EF Core. When I add a migration, EF Core ignores my mapping configuration.</p>
  <p>For example, the max length for all properties is max.</p>
  <p>Here's my code:</p>
  <p>Model class:</p>
  <pre><code>public class Product : EntityBase
  {
      public string Name { get; private set; }
      public string Code { get; private set; }
      public double UnitPrice { get; private set; }
      public bool IsInStock { get; private set; }
      public string ShortDescription { get; private set; }
      public string Description { get; private set; }
      public string Picture { get; private set; }
      public string PictureAlt { get; private set; }
      public string PictureTitle { get; private set; }
      public long CategoryId { get; private set; }
      public string Slug { get; private set; }
      public string Keywords { get; private set; }
      public string MetaDescription { get; private set; }
      public ProductCategory Category { get; set; }
  }
  </code></pre>
  <p>Mapping class:</p>
  <pre><code>public class ProductMapping:IEntityTypeConfiguration&lt;Product&gt;
  {
      public void Configure(EntityTypeBuilder&lt;Product&gt; builder)
      {
          builder.ToTable(&quot;Products&quot;);
          builder.HasKey(x =&gt; x.Id);
  
          builder.Property(x =&gt; x.Name).HasMaxLength(255).IsRequired();
          builder.Property(x =&gt; x.Code).HasMaxLength(15).IsRequired();
          builder.Property(x =&gt; x.ShortDescription).HasMaxLength(500).IsRequired();
          builder.Property(x =&gt; x.Picture).HasMaxLength(1000);
          builder.Property(x =&gt; x.PictureAlt).HasMaxLength(255);
          builder.Property(x =&gt; x.PictureTitle).HasMaxLength(500);
          builder.Property(x =&gt; x.Description).HasMaxLength(1000);
  
          builder.Property(x =&gt; x.Keywords).HasMaxLength(500).IsRequired();
          builder.Property(x =&gt; x.MetaDescription).HasMaxLength(150).IsRequired();
          builder.Property(x =&gt; x.Slug).HasMaxLength(500).IsRequired();
  
          builder.HasOne(x =&gt; x.Category)
              .WithMany(x =&gt; x.Products)
              .HasForeignKey(x =&gt; x.CategoryId);
      }
  }
  </code></pre>
  <p>Migration :</p>
  <pre><code>public partial class ProductAdd : Migration
  {
      protected override void Up(MigrationBuilder migrationBuilder)
      {
          migrationBuilder.CreateTable(
              name: &quot;Products&quot;,
              columns: table =&gt; new
              {
                  Id = table.Column&lt;long&gt;(type: &quot;bigint&quot;, nullable: false)
                      .Annotation(&quot;SqlServer:Identity&quot;, &quot;1, 1&quot;),
                  Name = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  Code = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  UnitPrice = table.Column&lt;double&gt;(type: &quot;float&quot;, nullable: false),
                  IsInStock = table.Column&lt;bool&gt;(type: &quot;bit&quot;, nullable: false),
                  ShortDescription = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  Description = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  Picture = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  PictureAlt = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  PictureTitle = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  CategoryId = table.Column&lt;long&gt;(type: &quot;bigint&quot;, nullable: false),
                  Slug = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  Keywords = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  MetaDescription = table.Column&lt;string&gt;(type: &quot;nvarchar(max)&quot;, nullable: true),
                  CreationDate = table.Column&lt;DateTime&gt;(type: &quot;datetime2&quot;, nullable: false)
              },
              constraints: table =&gt;
              {
                  table.PrimaryKey(&quot;PK_Products&quot;, x =&gt; x.Id);
                  table.ForeignKey(
                      name: &quot;FK_Products_ProductCategories_CategoryId&quot;,
                      column: x =&gt; x.CategoryId,
                      principalTable: &quot;ProductCategories&quot;,
                      principalColumn: &quot;Id&quot;,
                      onDelete: ReferentialAction.Cascade);
              });
  
          migrationBuilder.CreateIndex(
              name: &quot;IX_Products_CategoryId&quot;,
              table: &quot;Products&quot;,
              column: &quot;CategoryId&quot;);
      }
  
      protected override void Down(MigrationBuilder migrationBuilder)
      {
          migrationBuilder.DropTable(
              name: &quot;Products&quot;);
      }
  }
  </code></pre>
  <p>My context:</p>
  <pre><code>public class ShopContext:DbContext
  {
      public DbSet&lt;ProductCategory&gt; ProductCategories { get; set; }
      public DbSet&lt;Product&gt; Products { get; set; }
  
      public ShopContext(DbContextOptions&lt;ShopContext&gt; options):base(options)
      {
          
      }
  
      protected override void OnModelCreating(ModelBuilder modelBuilder)
      {
          var assembly = typeof(ProductCategory).Assembly;
          modelBuilder.ApplyConfigurationsFromAssembly(assembly);
          base.OnModelCreating(modelBuilder);
      }
  }
  </code></pre>