草庐IT

UserFriendship

全部标签

c# - Entity Framework 代码优先 : CASCADE DELETE for same table many-to-many relationship

我在EntityFramework和同一实体的多对多关系方面存在条目删除问题。考虑这个简单的例子:实体:publicclassUserEntity{//...publicvirtualCollectionFriends{get;set;}}流畅的API配置:modelBuilder.Entity().HasMany(u=>u.Friends).WithMany().Map(m=>{m.MapLeftKey("UserId");m.MapRightKey("FriendId");m.ToTable("FriendshipRelation");});我是否正确,无法在FluentAPI中定