builder.HasMany(x => x.Categories)
.WithMany(x => x.Centers)
.UsingEntity<CenterCategory>(x =>
{
x.Property(y => y.CenterId)
.HasColumnType("int unsigned")
.HasColumnName("center_id")
.IsRequired();
x.Property(y => y.CategoryId)
.HasColumnType("int unsigned")
.HasColumnName("category_id")
.IsRequired();
x.HasKey(y=> new {y.CenterId, y.CategoryId});
x.HasIndex(y => y.CenterId);
x.HasIndex(y => y.CategoryId);
x.ToTable("centers_categories");
x.HasOne(y => y.Center)
.WithMany()
.HasForeignKey(y => y.CenterId);
x.HasOne(y => y.Category)
.WithMany()
.HasForeignKey(y => y.CategoryId);
x.Navigation(y => y.Center);
x.Navigation(y => y.Category);
});