I have a .Net Core Web API project that uses Odata queries to retrieve information in JSON format.
I need to be able to save/insert the JSON information into a SQL table using ADO.Net.
I'm not sure about how to insert the complex objects.
Can someone offer any advice on how I would handle inserting the complex objects in the schema below?
{
"@odata.context": "https://sampleodata.azurewebsites.net/odata/$metadata#Ticket/$entity",
"TicketID": 67,
"UserID": 215,
"TicketName": "Folder Access",
"TicketCompletionDate": "2021-01-25T00:00:00Z",
"Targets": [
{
"TargetID": 354,
"TargetName": "Urgent Request",
"TargetCompletionDate": "2021-01-25T00:00:00Z",
"TargetStatus": "Resolved",
"TargetDueDate": null,
"Encounters": [
{
"EncounterID": 243,
"EncounterName": "Assigned to IT Department",
"EncounterCompletionDate": "2020-02-10T00:00:00Z",
"EncounterLastUpdatedBy": "John Doe"
},
{
"EncounterID": 244,
"EncounterName": "Assigned to Employee",
"EncounterCompletionDate": "2020-02-10T00:00:00Z",
"EncounterLastUpdatedBy": "Jane Doe"
},
{
"EncounterID": 245,
"EncounterName": "Assigned To Finance Department ",
"EncounterCompletionDate": "2020-06-12T00:00:00Z",
"EncounterLastUpdatedBy": "Jane Doe"
}
]
}
],
"Users": []
}
Tickets can contain multiple targets and users.
Targets can contain multiple encounters.