Specify ON DELETE NO ACTION in ASP.NET MVC 4 C# Code First

后端 未结 5 540
情歌与酒
情歌与酒 2021-01-01 09:57

How do I specify ON DELETE NO ACTION Foreign Key Constraint in my model designs?

At present, I have:

public class Status
{
    [Required]
    public          


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-01 10:47

    Just make the FK property nullable, then the cascade delete will be gone.

    public int? StatusId { get; set; }
    

提交回复
热议问题