Entity Framework Core: How to solve Introducing FOREIGN KEY constraint may cause cycles or multiple cascade paths

后端 未结 4 919
清酒与你
清酒与你 2021-01-11 10:30

I\'m using Entity Framework Core with Code First approach but recieve following error when updating the database:

Introducing FOREIGN KEY constraint \

4条回答
  •  失恋的感觉
    2021-01-11 10:59

    public Guid? UsuarioId { get; set; }
    
    builder.Entity()
           .HasOne(x => x.Usuario)
           .WithMany(x => x.Orcamentacaos)
           .OnDelete(DeleteBehavior.Restrict)
           .IsRequired(false)
           .HasForeignKey(x => x.UsuarioId);
    

提交回复
热议问题