Skip to content
Discussion options

You must be logged in to vote

Pra solucionar, utilizei o seguinte código (diferente do que é mostrado na aula):

builder.HasMany(x => x.Tags)
      .WithMany(x => x.Posts)
      .UsingEntity<Dictionary<String, object>>(
          "PostTag",
          post => post.HasOne<Tag>()
                      .WithMany()
                      .HasForeignKey("TagId")
                      .HasConstraintName("FK_PostTag_TagId")
                      .OnDelete(DeleteBehavior.Cascade),
          tag => tag.HasOne<Post>()
                      .WithMany()
                      .HasForeignKey("PostId")
                      .HasConstraintName("FK_PostTag_PostId")
                      .OnDelete(DeleteBehavior.Cascade)
      );

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by andrebaltieri
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants