private static void ModifyDetailsForSalesOrder() { using (var context = new AWEntities()) { var detailList = context.SalesOrderDetails.Where(d => d.SalesOrderID == 71816).ToList(); // modify an OrderDetail detailList[0].OrderQty = 10; //delete an OrderDetail context.DeleteObject(detailList[1]); //insert a new OrderDetail var product = context.Products.SingleOrDefault(p => p.ProductID == 711); var newDetail = new SalesOrderDetail { SalesOrderID = 71816, ProductID = product.ProductID, OrderQty = 2, UnitPrice = product.ListPrice, UnitPriceDiscount = 0, ModifiedDate = DateTime.Today }; context.SalesOrderDetails.AddObject(newDetail); context.SaveChanges(); } }