Let's say I have the following entities:
Box
Id
Crank crank // has one required relationship
Crank
Id // does not care about the box
What is the proper way to define BoxMap? Is this sufficient? Or do I need WithRequiredPrincipal
(which I have no idea what that does):
HasKey(t => t.Id);
ToTable("Boxes")
Property(t=>t.Id).HasColumnName("Id")
Property(t=>t.CrankId).HasColumnName("Crank_Id")
HasRequired(t=>t.Crank)
NOTE: Any good resources on learning fluent api are welcome. Thanks.
You don't need to specify this:
It will be detected by convention of EF.