IExpressionEval::CreateEvalContext

Ee825868.c++_off(en-US,CS.10).gifEe825868.vb_on(en-US,CS.10).gif

Use this method to create a new ExprEvalContext object and place it into the context cache. This allows evaluation of multiple expressions against the same set of profile objects in the most efficient manner possible.

Definition

HRESULT IExpressionEval::CreateEvalContext(IDictionary*pDictObjs,IExprEvalContext**ppContext);

Parameters

pDictObjs

[in] A pointer to the IDictionary interface of a Dictionary object that contains the set of profiles to be cached.

ppContext

[out, retval] The address of the pointer to the IExprEvalContext interface of the newly created ExprEvalContext object.

Return Values

This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

Error Values

This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

Remarks

The CreateEvalContext method creates an ExprEvalContext object that uniquely identifies a new evaluation context and stores the object in the context cache. Use the EvalInContext method to evaluate multiple expressions within the context defined by the ExprEvalContext object. This process is more efficient than using the Eval method which generates and destroys a new context for each expression evaluated.

A context is a set of profiles containing data to evaluate expressions against. Profiles may be ProfileObject objects, Dictionary objects, or other objects that support property access through the IDispatch interface. Initially only references to the profile objects are held in the context cache. During evaluation, when property values are read from the profiles, the property values may themselves be held in the cache for faster access during subsequent evaluations.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

The ppContext parameter contains valid data only if the method completes successfully.

Ee825868.caution(en-US,CS.10).gifCaution

  • The state of the profile objects should not be externally changed during the lifetime of the ExprEvalContext object; doing so leads to non-deterministic evaluation results.

See Also

ExpressionEval Object

IExpressionEval::EvalInContext


All rights reserved.