CompositionAttribute Class

WCF RIA Services

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Indicates that a member represents an association that is part of a compositional hierarchy.


Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)

[AttributeUsageAttribute(AttributeTargets::Property|AttributeTargets::Field, AllowMultiple = false, 
	Inherited = true)]
public ref class CompositionAttribute sealed : public Attribute

The CompositionAttribute type exposes the following members.

Public methodCompositionAttributeInitializes a new instance of the CompositionAttribute class.

Public propertyTypeId (Inherited from Attribute.)

Public methodEquals (Inherited from Attribute.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Attribute.)
Public methodGetType (Inherited from Object.)
Public methodIsDefaultAttribute (Inherited from Attribute.)
Public methodMatch (Inherited from Attribute.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)

Explicit interface implemetationPrivate method_Attribute::GetIDsOfNames (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute::GetTypeInfo (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute::GetTypeInfoCount (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute::Invoke (Inherited from Attribute.)

You apply the CompositionAttribute to a property that represents an association between two entities that are conceptually part of a hierarchy, such as a SalesOrderHeader entity and a SalesOrderDetail entity. These related entities are known as a compositional hierarchy. After defining the compositional hierarchy between the classes, you can perform data modification operations on the entities as a single unit instead of as separate entities. This simplifies middle-tier logic because you can write application logic for the entire hierarchy instead of splitting that logic into each entity and attempting to coordinate that split logic during data operations. For more information, see Compositional Hierarchies.

The following example shows how to define a compositional relationship between SalesOrderHeader and SalesOrderDetail by using a metadata class.

No code example is currently available or this language may not be supported.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.