Share via


IMetaDataDispenserEx::SetOption Method

Sets the specified option to a given value for the current metadata scope. The option controls how calls to the current metadata scope are handled.

HRESULT SetOption (
    [in] REFGUID optionId, 
    [in] const VARIANT *pValue
);

Parameters

Parameter Description

optionId

[in] A pointer to a GUID that specifies the option to be set.

pValue

[in] The value to use to set the option. The type of this value must be a variant of the specified option's type.

Remarks

The following table lists the available GUIDs that the optionId parameter can point to and the corresponding valid values for the pValue parameter.

GUID Option pValue Parameter

MetaDataCheckDuplicatesFor

Duplicate checks. Controls which items are checked for duplicates and which are not. That is, each time you call an IMetaDataEmit Interface method that creates a new item, you can ask the method to check whether the item already exists in the current scope. For example, you can ask for checking on mdMethodDef items; in this case, when you call IMetaDataEmit::DefineMethod Method, it will check that the method does not already exist in the current scope. This check uses the key that uniquely identifies a given method: parent type, name, and signature.

Must be a variant of type UI4, and contain a combination of values of the CorCheckDuplicatesFor Enumeration enumeration.

MetaDataRefToDefCheck

Ref-to-Def optimizations. Controls which referenced items are converted to definitions. By default, the metadata engine will optimize the code by converting a referenced item to its definition if the referenced item is actually defined in the current scope.

Must be a variant of type UI4, and contain a combination of values of the CorRefToDefCheck Enumeration enumeration.

MetaDataNotificationForTokenMovement

Notifications on token movement. Controls which token remaps that occur during a metadata merge, generate callbacks. Use the IMetaDataEmit::SetHandler Method method to establish your IMapToken Interface interface.

Must be a variant of type UI4, and contain a combination of values of the CorNotificationForTokenMovement Enumeration enumeration.

MetaDataSetENC

ENC Modes. Controls the behavior of edit-and-continue (ENC). Only one mode of behavior can be set at a time.

Must be a variant of type UI4, and contain a value of the CorSetENC Enumeration enumeration. The value is not a bitmask.

MetaDataErrorIfEmitOutOfOrder

Emit out-of-order. Controls which "emitted-out-of-order" errors generate callbacks. Emitting metadata out-of-order is not fatal; however, if you emit metadata in an order that is favored by the metadata engine, the metadata is more compact and, thus, can be more efficiently searched. Use the IMetaDataEmit::SetHandler Method method to establish your IMetaDataError Interface interface.

Must be a variant of type UI4, and contain a combination of the values of the CorErrorIfEmitOutOfOrder Enumeration enumeration.

MetaDataImportOption

Import options. Controls which kinds of items that were deleted during an ENC, are retrieved by an enumerator.

Must be a variant of type UI4, and contain a combination of the values of the CorImportOptions Enumeration enumeration.

MetaDataThreadSafetyOptions

Thread-safety options. Controls whether the metadata engine obtains reader/writer locks, thereby ensuring thread safety. By default, the engine assumes access is single-threaded by the caller, so no locks are obtained. Clients are responsible for maintaining proper thread synchronization when using the Metadata (Unmanaged API Reference) APIs.

Must be a variant of type UI4, and contain a value of the CorThreadSafetyOptions Enumeration enumeration. The value is not a bitmask.

MetaDataGenerateTCEAdapters.

Generate TCE Adapters. Controls whether the type library importer should generate the tightly coupled event (TCE) adapters for COM connection point containers.

Must be a variant of type BOOL. If pValue is set to true, then the type library importer generates the TCE adapters.

MetaDataTypeLibImportNamespace

Namespace. Specifies a non-default namespace for the type library that is being imported.

Must be either a null value or a variant of type BSTR. If pValue is NULL value, then the current namespace is set to NULL; otherwise, the current namespace is set to the string that is held in the variant's BSTR type.

MetaDataLinkerOptions

Linker options. Controls whether the linker should generate an assembly or a .NET module file.

Must be a variant of type UI4, and contain a combination of the values of the CorLinkerOptions Enumeration enumeration.

MetaDataRuntimeVersion

Runtime version. Specifies the version of the common language runtime against which this image was built. The version is stored as a string, such as "v1.0.3705".

Must be a null value, a VT_EMPTY value, or a variant of type BSTR. If pValue is NULL, the runtime version is set to NULL; if pValue is VT_EMPTY, the version is set to a default value, which is drawn from the version of Mscorwks.dll within which the metadata code is running; otherwise, the runtime version is set to the string that is held in the variant's BSTR type.

Requirements

Platform: Windows 2000, Windows XP, Windows Server 2003 family

Header: Cor.h

Library: Used as a resource in Mscoree.dll

.NET Framework Version: 2.0, 1.1, 1.0

See Also

Reference

IMetaDataDispenserEx Interface
IMetaDataDispenser Interface