Context.CurrentMiningModel Property

Gets the current mining model.

Namespace:  Microsoft.AnalysisServices.AdomdServer
Assembly:  msmgdsrv (in msmgdsrv.dll)

public static MiningModel CurrentMiningModel { get; }

Property Value

Type: Microsoft.AnalysisServices.AdomdServer.MiningModel
A MiningModel that represents the current mining model; null if not applicable.

The return value will be null when called from a Multidimensional Expressions (MDX) query, or as a stored procedure. For more information on the differences between user-defined functions (UDFs) and stored orocedures, see User Defined Functions and Stored Procedures.

In the following example, a UDF is created that returns the node description for a specified node. It uses the current context in which it is being run, retrieves the node from the current mining model (determined by the DMX FROM clause):

public string GetNodeDescription(string nodeUniqueName)
    return Context.CurrentMiningModel.GetNodeFromUniqueName(nodeUniqueName).Description;

Community Additions