IKeyStore::SetKeyValue method (dbgmodel.h)

The SetKeyValue method is analogous to the SetKeyValue method on IModelObject. This method is not capable of creating a new key within the metadata store. If there is an existing key as indicated by the key argument, its value will be set as indicated. If the key is a property accessor, the SetValue method will be called on the property accessor in order to set the underlying value. Note that metadata is typically static once created. Use of this method on a metadata key store should be infrequent.

Syntax

HRESULT SetKeyValue(
  PCWSTR       key,
  IModelObject *object
);

Parameters

key

The name of the key to set a value for.

object

The value to assign to the key. If the current key's value is a property accessor, the SetValue method will be called on the property accessor to set the underlying value.

Return value

This method returns HRESULT that indicates success or failure.

Remarks

Code Sample

ComPtr<IKeyStore> spMetadata; /* get a metadata store */
ComPtr<IModelObject> spValue; /* get a value to set */

// This never creates a key.  Most callers should prefer SetKey
if (SUCCEEDED(spMetadata->SetKeyValue(L"KnownExistingKey", spValue.Get()))
{
    // The key's value was successfully set.
}

Requirements

Requirement Value
Header dbgmodel.h

See also

IKeyStore interface