Create an association between entities
You can define relationships between entities in your Business Data Connectivity (BDC) model by creating associations. Visual Studio generates methods that provide consumers of the model with information about each association. These methods can be consumed by SharePoint web parts, lists, or custom applications to display data relationships in a user interface (UI).
You can create two types of associations in the BDC designer: foreign key-based associations and foreign keyless associations. For more information, see Create an association between entities.
To create an association between entities
On the BusinessDataConnectivity tab of the Toolbox, choose the Association item.
On the BDC Designer, choose the source entity, and then choose the destination entity.
The Association Editor appears.
If you want to create a foreign key-based association, select the Is Foreign Key Association check box.
In the Source ID column of the Identifier Mapping table, choose the identifier next to each matching type descriptor that appears in the Field column.
For example, In the Source ID column, select
ContactID
next to theReadList.salesOrderList.SalesOrderList.SalesOrder.ContactID
type descriptor and theReadItem.salesOrder.SalesOrder.ContactID
type descriptor.
If you want to create a foreign keyless association, clear the Is Foreign Key Association check box.
Choose the OK button.
On the BDC Designer, a line that represents the association appears between the source entity and the destination entity.
Visual Studio adds an Association Navigator method to the service class of the destination entity and the service class of the source entity. For more information about Association Navigation methods, see Supported Operations.
In the Association Navigator method of the source entity, add code that returns a collection of destination entities.
In the Association Navigator method of the destination entity, add code that returns the related source entity.
For examples of Association Navigator methods, see Create an association between entities.
Related content
- Create an association between entities
- Design a business data connectivity model
- How to: Add a Finder method
- How to: Add a specific Finder method
- How to: Add a Creator method
- How to: Add a Deleter method
- How to: Add an Updater method
- BDC model design tools overview
- How to: Add a parameter to a method
- How to: Define a method instance
- How to: Define the type descriptor of a parameter
- Walkthrough: Create an external list in SharePoint by using business data