EF Core - EntityTypeBuilder One to Many Relationship?

c# entity-framework-core

Popular Answer

EmployeerConfig is acceptable Adding a key is optional.

I hope this will be helpful. Add this line to Branch Config.

     builder.HasMany(x => x.Employee).WithOne(b => b.Branch).HasForeignKey(b => b.BranchId)
    .OnDelete(DeleteBehavior.Cascade);
0
7/31/2019 2:30:56 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