Configuring cascade delete with EF7

孤人 提交于 2019-12-11 03:25:48

问题


I'm trying to configure a cascade delete using EF7 in a ASP.NET vNext application but I cannot find how to do it.

I'm overriding OnModelCreating and I have this code:

  modelBuilder.Entity<Category>()
              .OneToMany<Category>( e => e.SubCategories )
              .ForeignKey( e => e.ParentCategoryId );

The generated migration looks like this:

    migrationBuilder.AddForeignKey("Category", "FK_Category_Category_ParentCategoryId", new[] { "ParentCategoryId" }, "Category", new[] { "Id" }, cascadeDelete: false);

Anyone know in what namespace the extensions to configure the cascade delete are defined?

Thanks!


回答1:


Promoting comment from lukew to an answer...

This is not yet implemented, work is being tracked here github.com/aspnet/EntityFramework/issues/333



来源:https://stackoverflow.com/questions/27800940/configuring-cascade-delete-with-ef7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!