Entity Framework: Update related entities
问题 I have two entities: Invoice and InvoiceDetail. Invoice has an InvoiceDetails member. When I create an obcjet it works as expected. The framework inserts the Invoice and the InvoiceDetail rows in the database. $.ajax({ url: "/Invoices/Index", data: JSON.stringify({ InvoiceDetails: [{ Description: "1" }, { Description: "2" }] }), contentType: "application/json", type: "POST" }); [ActionName("Index")] [HttpPost] public JsonResult Post(Invoice invoice) { db.Invoices.AddObject(invoice); db