Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of setting up cascade delete in EF Core using Fluent API
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Metadata;
public class MyDBContext : DBContext
public DbSet<Blog> Blog { get; set; }
public DbSet<Post> Posts { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasOne(p => p.Blog)
.WithMany(b => b.Posts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.