I'm using EF code first. By convention, I have added a foreign key and a reference to the foreign object (I believe this is needed). When I send a Get request to the API, it returns an IEnumerable. The problem is that each record returned also returns the complete object for the foreign key.
I've tried Googling the answer and for questions here on SO. I tried commenting out the reference to the other object but that didn't work.
public class Bill
{
// other properties
public Guid PersonId { get; set; } // this is the foreign key
public Person Person { get; set; } // this is the reference to the foreign object
}
This is what is returned when executing the Get request:
[
{
//other fields
"personId": "c28e52b0-1e40-46c4-812b-a61be7a69d53",
"person": {
//the entire other person object is returned here
}
},
]
How do I solve this without establishing a DTO for every model?
I'd like to hear if I'm using code first conventions improperly.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)