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

  • 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 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, 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.

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.

MetaDataNotificationForTokenMovement

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

Must be a variant of type UI4, and contain a combination of values of the CorNotificationForTokenMovement 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. 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 to establish your IMetaDataError interface.

Must be a variant of type UI4, and contain a combination of the values of the CorErrorIfEmitOutOfOrder 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 API.

Must be a variant of type UI4, and contain a value of the CorThreadSafetyOptions 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.

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.

MetaDataMergerOptions

Specifies options for merging metadata.

Must be a variant of type UI4, and contain a combination of the values of the MergeOptions enumeration, which is described in the corhdr.h file.

Requirements

Platform: See .NET Framework System Requirements.

Header: Cor.h

Library: Used as a resource in MsCorEE.dll

.NET Framework Versions: 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0

See Also

Reference

IMetaDataDispenserEx Interface

IMetaDataDispenser Interface

Change History

Date

History

Reason

March 2009

Added MetaDataMergerOptions.

Content bug fix.