Answer the question
In order to leave comments, you need to log in
Entity Framework: How to save an object with a large nesting of detached objects?
Good day.
At the front, an object of this kind is collected from data / edited:
{
"author": {
"id": 119,
"displayName": "System"
},
"modify": {
"id": 119,
"displayName": "System"
},
"chapters": {
"chapterList": [{
"author": {
"id": 119,
"displayName": "System"
},
"modify": {
"id": 119,
"displayName": "System"
},
"id": 99,
"creationDate": "2018-06-27T10:50:27.75+03:00",
"modifyDate": "2018-06-27T10:50:27.75+03:00",
"title": "chapter 3"
},
{
"author": {
"id": 119,
"displayName": "System"
},
"modify": {
"id": 119,
"displayName": "System"
},
"id": 97,
"creationDate": "2018-06-27T10:50:27.75+03:00",
"modifyDate": "2018-06-27T10:50:27.75+03:00",
"title": "Chapter 1"
}],
"Id": 37
},
"id": 58,
"createDate": "2018-06-27T10:50:27.79+03:00",
"modifyDate": "2018-06-27T11:03:07.55+03:00",
"title": "Project 1"
}
public void Endpoint(Project project){
dbContext.Projects.Attach(project);
dbContext.SaveChanges();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question