EntityFramework CodeFirst: CASCADE DELETE for same table many-to-many relationship
问题 I have an entry removal problem with the EntityFramework and a many-to-many relationship for the same entity. Consider this simple example: Entity: public class UserEntity { // ... public virtual Collection<UserEntity> Friends { get; set; } } Fluent API Configuration: modelBuilder.Entity<UserEntity>() .HasMany(u => u.Friends) .WithMany() .Map(m => { m.MapLeftKey("UserId"); m.MapRightKey("FriendId"); m.ToTable("FriendshipRelation"); }); Am I correct, that it is not possible to define the