How to: Attach Related Objects

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This topic provides examples of how to attach related objects to an object context. For more information, see Attaching and Detaching Objects. The example in this topic is based on the Adventure Works Sales Model. To run the code in this example, you must have already added the AdventureWorks Sales Model to your project and configured your project to use the Entity Framework. To do this, complete the procedures in How to: Manually Configure an Entity Framework Project and How to: Manually Define the Model and Mapping Files.

Example

This example adds a collection of detached SalesOrderDetail objects to a detached SalesOrderHeader object and then attaches this object graph to the object context.

See Also

Show: