private void Seed() { using var context = new ApplicationDb(ContextOptions); context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var category1 = new CategoryData { Name = "One" }; var category2 = new CategoryData { Name = "Two", SupCategoryData = category1 }; var category3 = new CategoryData { Name = "Three", SupCategoryData = category2 }; context.AddRange(category1, category2, category3); context.SaveChanges(); }