[This is preliminary documentation and subject to change.]
Web-Based Enterprise Management (WBEM) identifies instances through the use of keys, or properties that provide a unique value. Key properties are designated by the Key qualifier, a standard qualifier defined by WBEM. Key qualifiers can be attached to more than one property in a class to create a compound key for the class. Properties chosen as key properties for a class must contain values that can uniquely identify each instance of the class.
The following MOF syntax illustrates how to define a class with a single key property:
class MyClass
{
[key] string MyKey;
string RegularProp;
}
When a superclass class specifies a key, all of the derived classes inherit that key. The derived classes cannot alter the inherited key or define any new key properties. However, when a subclass derives from an abstract class without a key, the subclass is permitted to introduce its own key.
A property must be one of the following types to be able to act as a key:
All classes that define more than one instance must specify a key. Because abstract classes do not define any instances, they need not specify keys. Because singleton classes define only one instance, they cannot specify keys.