Export (0) Print
Expand All

Association

SharePoint 2007

An Association object links related entities within a system. For example, a customer is associated with a salesorder in the AdventureWorks system: a customer makes sales orders. An association holds pointers to the parent and child entities as well as a pointer to the business logic (a MethodInstance object) that allows a client to get the child entity from the parent entity. The traversal of an association is a method call on the line-of-business (LOB) system.

The SourceEntity and DestinationEntity objects are not separate metadata objects. They are instances of the Entity metadata object. Both SourceEntity and DestinationEntity objects should exist in the same LobSystem object.

The association logic (MethodInstance) can be on any entity, either source or destination or an unrelated entity. However, the order in which you define the source and destination entities is very important because the XML file is processed from top to bottom. Therefore, ensure that the entities referenced in the association method are defined before the entity containing the association method. If they are not in the right order, you will receive an error when you try to add the application definition to the Business Data Catalog. This is because the association method will contain references to entities that are not yet created.

The Business Data Catalog supports multiple SourceEntity and one DestinationEntity object scenario. For a sample, see the SampleWebService.

An Association MethodInstance object contains slots in the input for the identifier values of the source entity instance, and a slot in the output for the identifier values of the destination entity instances. Therefore, you must tag enough input TypeDescriptor objects tagged with identifiers corresponding to each identifier of each entity that is a source in the association in the Association method. The IdentifierName attribute on an input TypeDescriptor object signals the Business Data Catalog to insert the identifier value of the entity instance of relevance before executing the method. For example, in an Association MethodInstance, the user has probably provided the identifier values for the source entity instance that they want to retrieve. The Business Data Catalog will insert that value into this slot after fully instantiating this parameter by using all the default values.

The Business Data Catalog also supports Foreign Key pseudo-associations. Foreign Key pseudo-associations are not first-class associations. Consider a Web method that returns Customer, and that one of the fields of a Customer is the Key to the Address of the Customer. A metadata modeler may reuse this method as a Customer-Association method. The Business Data Catalog also supports Foreign Key pseudo-associations. Foreign Key pseudo-associations see that the target of this method is an Address, fetch the Key of the Address from the returned Customer and then calls Address.FindSpecific() on it to return the Address automatically.

NoteNote:

The Business Data Catalog does not support cyclic chaining of entities via associations. That is, it does not support "Entity A is related to Entity B is related to Entity C is related to Entity A".

<Associations>
   <Association AssociationMethodEntityName=" Customer" 
      AssociationMethodName=" GetSalesOrdersForCustomer" 
      AssociationMethodReturnParameterName="SalesOrders" 
      Name=" CustomerToSalesOrder" IsCached="true">
      <SourceEntity Name="Customer" /> 
      <DestinationEntity Name="SalesOrder" /> 
   </Association>
</Associations>

Child Type Occurs Default Limits / Accepted Values Description

AssociationMethodEntityName

Attribute (String)

1..1

The name of entity containing the method that traverses the association.

AssociationMethodName

Attribute (String)

1..1

The name of the method that traverses the association.

AssociationMethodReturnParameterName

Attribute (String)

1..1

The name of the return parameter that contains the destination entity instances.

SourceEntity

Element

1..many

Represents a source entity in the associations. Associations may have multiple source entities. For example, in SAP a Customer and Sales Area are needed to get a list of Sales Orders.

DestinationEntity

Element

1..1

Children

Child Type Occurs Default Limits / Accepted Values Description

Name

Attribute (String)

1..1

The name of a source entity in the association.

Children

Child Type Occurs Default Limits / Accepted Values Description

Name

Attribute (String)

1..1

The name of a destination entity in the association.

Community Additions

ADD
Show:
© 2014 Microsoft