I have a cascade delete on a database and I don't want EF to do cascade delete for this many to many relationship, because it's redundant and slow.
public class ArtikliBojeEC : EntityTypeConfiguration<ArtikliBoje>
{
public ArtikliBojeEC()
{
this.HasMany(e => e.ArtikliVelicine).WithMany(e => e.ArtikliBoje)
.Map(m => m.ToTable("ArtikliBojeVelicine").MapLeftKey("ArtikliBojeId").MapRightKey("ArtikliVelicineId"));
this.Ignore(e => e.VezaNaVelicinu);
}
}
I also tried putting this OnModelCreating, with no effect, EF still calls delete for every many to many link table:
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
Have you tried this?