I am working with a .net 6 api, and I have a large object that needs to be inserted into a database through an endpoint. The object itself will be split into 4-5 different tables.
This object will have some relations, that could already exist in the database. For example, if we call this big object “request”, it is going to have a “location” many-to-many relation, so this can mean that a new request can be inserted while having a “location” which already exists in the database.
How do you handle this in a normal way? Im guessing that I can’t just map the object and say context.Add(object). Do I have to check for every relation, and context.Add() or context.Update() accordingly? Or is there a better way?