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

Represents a relationship type definition in a management pack.

Schema Hierarchy

ManagementPack
  TypeDefinitions
    EntityTypes
      RelationshipTypes
        RelationshipType

Syntax

Xml
<RelationshipType ID=”Company.Product.RelationshipID” Accessibilty=”Public/Internal” Abstract=”False” Base=”System!System.Hosting/System!System.Containment/System!System.Reference/System!System.WatchedBy” >   <Source>Company.Product.SourceClass</Source>   <Target>Company.Product.TargetClass<Target>   <Property>…</Property>
</RelationshipType>

Attributes and Elements

The following sections describe attributes, child elements, and parent element of a RelationshipType element.

Attributes

Attribute Description

ID

Required attribute. Represents the identity of the element. To learn how to identify your element in a management pack, see Element Identity and Namespace Conventions.

Accessibility

Required attribute. Defines the visibility of the relationship type.

Abstract

Required attribute. Defines whether or not the relationship type is abstract or concrete. For relationship type elements, this value must always be false.

Base

Required attribute. Contains the ID of one of the four base relationship types from which the relationship type element must inherit.

Accessibility Attribute Values

Value Description

Public

Indicates that this relationship type will be visible to external management packs for targeting or inheritance.

Internal

Indicates that this relationship type will not be accessible from any external management pack.

Base Attribute Values

Value Description

System!System.Containment

Indicates that this relationship type inherits from the System.Containment base relationship type defined in the System.Library management pack. A containment relationship indicates that the Target class type can optionally be contained inside the Source class type. Typically a containment relationship type defines a group where certain class types are members but can also exist independently of the group.

The containment relationship type is a many-to-many relationship type, meaning that the Source class type can contain any number of instances of the Target class type and that the Target class type can be contained by any number of instances of the Source class type.

Health state can be rolled up across a containment relationship type.

System!System.Hosting

Indicates that this relationship type inherits from the System.Hosting relationship type defined in the System.Library management pack. A hosting relationship indicates that the Target class type cannot be discovered and instantiated without the prior discovery and instantiation of the Source class type. An example of the hosting relationship is a SQL database that is running in a SQL Server instance. A class type representing a SQL Server instance cannot exist without the existence of a SQL database class type.

The hosting relationship type is a one-to-many relationship type, meaning that the Source class type can host any number of instances of the Target type but that the Target type can be hosted by only one instance of the Source class type. Furthermore, dependency rules are strictly enforced. If the Source class type is deleted from the management group, all Target class types will also be deleted.

Health state can be rolled up across a hosting relationship.

System!System.Reference

Indicates that this relationship type inherits from the System.Reference relationship type defined in the System.Library management pack. A reference relationship indicates that the Source class type references the Target class type and that no interdependency exists between the two. For example, a database could reference another database that it is replicating. The existence of each of the databases is not dependent on the other, and the objects are discovered separately.

The reference relationship is a many-to-many relationship type, meaning that the Source class type can reference any number of instances of the Target class type and that the Target class type can be referenced by any number of instances of the Source class type.

Health state cannot be rolled up across a reference relationship.

Child Elements

Element Description

Source

Represents the origination point of the defined relationship

Target

Represents the object of the defined relationship.

Property (RelationshipType)

Optional element. Defines a property of the relationship type that is populated during discovery.

Parent Elements

Element Description

RelationshipTypes

Contains definitions of relationship types to be discovered.

Remarks

Before creating a RelationshipType element between two ClassType definitions, it is important to identify whether or not existing relationships already exist. When a ClassType element is inherited, any relationships defined against class types in its ancestry tree are also inherited. In the case of a hosting relationship type, it is not permissible to declare a new hosting relationship if the class type has already inherited a hosting relationship type from one of its ancestors.

Example

The following example shows how each of the three allowable relationship types (Hosting, Containment, and Reference) are defined in a management pack. The first RelationshipType element illustrates a hosting relationship where every discovered Microsoft.SQLServer.2005.Database class type must be hosted by a Microsoft.SQLServer.2005.DBEngine discovered class. Because this is a hosting relationship, the Microsoft.SQLServer.2005.Database class type must be a member of this group in order to be discovered.

The second RelationshipType element illustrates a containment relationship where an InstanceGroup class type is defined to contain all discovered instances of Microsoft.SQLServer.2005.DBEngine class types found in the management group. Because this is a containment relationship, the Microsoft.SQLServer.2005.DBEngine class type does not have to be a member of this group in order to be discovered.

The third RelationshipType element illustrates the reference relationship where any one Microsoft.SQLServer.2005.Database class type can reference any other Microsoft.SQLServer.2005.Database class type. There is no order of discovery imposed on this RelationshipType element, and there are no dependencies between Source and Target classes.

  Copy Code
<RelationshipTypes> 
  <RelationshipType ID="Microsoft.SQLServer.2005.DBEngineHostsDatabase" Accessibility="Public" Base="System!System.Hosting"> 
	<Source>Microsoft.SQLServer.2005.DBEngine</Source>
	<Target>Microsoft.SQLServer.2005.Database</Target> 
  </RelationshipType> 
 <RelationshipType ID="Microsoft.SQLServer.2005.InstanceGroupContainsDBEngine" Accessibility="Public" Base="System!System.Containment">
	<Source>Microsoft.SQLServer.2005.InstanceGroup</Source>
	<Target>Microsoft.SQLServer.2005.DBEngine</Target> 
 </RelationshipType> 
 <RelationshipType ID="Microsoft.SQLServer.2005.DatabaseReplicatesWithDatabase" Accessibility="Public" Base="System!System.Reference">
	<Source>Microsoft.SQLServer.2005.Database</Source>
	<Target>Microsoft.SQLServer.2005.Database</Target> 
 </RelationshipType> 
</RelationshipTypes>
Note
Like the ClassType and Property (ClassType) elements, relationship types should also define display strings for at least one language. For more information, see Property (ClassType).

See Also