I\'m trying to get information from some of my models that have a foreign key relationships to my main employee model. If I map out each model individually, I can access the
You are right. I had similar issue. Something like this
[ForeignKey("StatesTbl")]
public int? State { get; set; }
public StatesTbl StateTbl { get; set; }
So as you can see, I had kept name 'StateTbl' in the last line instead of 'StatesTbl' and app kept looking for StateTblID. Then I had to change name to 'StatesTbl' instead. And then it started working well. So now, my changed lines were:
[ForeignKey("StatesTbl")] <== 'StatesTbl' is my original States table
public int? State { get; set; }
public StatesTbl StatesTbl { get; set; }
These are in the AppDbContext.cs class file