✅ ASP.NET API (EF Core) Relationships
Using the following example in my learnings, I'm struggling to make this work the way I want it to.
When using swagger to POST a new
Employee
, if I want to specify a related Company
I have to Include all the fields from the Company table, and the API creates a new Company
record along with the new Employee
record. So this is what it requires right now:
What I'd like to do is provide just a Company.Id
for an existing Company
record... So something like the this to add a new Employee
, which includes the id 100
of an existing Company
record:
I'm not sure how to make that work?2 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.