Configuring cascade delete with EF7

asp.net-core entity-framework-core

Question

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
2
2/5/2015 4:13:43 AM

Popular Answer

Promoting comment from lukew to an answer...

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

6
1/19/2015 10:32:09 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow