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

后端 未结 5 513
情歌与酒
情歌与酒 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:42

    Put this into your MenuEntities class (class that descend from DbContext):

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
       modelBuilder.Conventions.Remove(); 
    }
    

提交回复
热议问题