Turning off shadow property generation
Turning off shadow property generation I'm having a weird issue with setting Entity Framework Core foreign keys. EF keeps adding a shadow property automatically for my property and is creating a foreign key of it. That would be perfectly fine for me, however - I want to be able to set the foreign key delete behaviour to cascade - using that "automatic" shadow property I'm not allowed to do that. Therefore I decided to create my own foreign key with the Fluent API: modelBuilder.Entity<PostDataModel>(e => { // Primary key e.HasKey(c => c.Id); // Relation e.HasOne<PostGroupDataModel>() .WithMany() .HasForeignKey("GroupId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); This however, did not help much - automatically generated shadow property is still being generated for the table ( GroupId1 ): GroupId1 public class PostGroupDataModel { public int Id { get; set; } public string Name ...