Gets or sets the class that is the context for the override. Namespace: Microsoft.EnterpriseManagement.Configuration
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in microsoft.enterprisemanagement.operationsmanager.dll)

Usage

Visual Basic
Dim instance As ManagementPackOverride
Dim value As ManagementPackElementReference(Of ManagementPackClass)

value = instance.Context

instance.Context = value

Syntax

Visual Basic
Public Property Context As ManagementPackElementReference(Of ManagementPackClass)
C#
public ManagementPackElementReference<ManagementPackClass> Context { get; set; }
C++
public:
property ManagementPackElementReference<ManagementPackClass^>^ Context {
		ManagementPackElementReference<ManagementPackClass^>^ get ();
		void set (ManagementPackElementReference<ManagementPackClass^>^ value);
}
J#
/** @property */
public ManagementPackElementReference<ManagementPackClass> get_Context ()

/** @property */
public void set_Context (ManagementPackElementReference<ManagementPackClass> value)
JScript
public function get Context () : ManagementPackElementReference<ManagementPackClass>

public function set Context (value : ManagementPackElementReference<ManagementPackClass>)

Property Value

A ManagementPackElementReference reference to a ManagementPackClass object.

Example

The following code example shows how to get the MonitoringClass object that is the context for the override.

C#  Copy Code
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement;
using System.Collections.ObjectModel;
using Microsoft.EnterpriseManagement.Common;
using Microsoft.EnterpriseManagement.Monitoring;

namespace SDKSamples
{
	class Program
	{
		static void Main(string[] args)
		{
			ManagementGroup mg = new ManagementGroup("localhost");
			ReadOnlyCollection<ManagementPackOverride> overrides = mg.GetMonitoringOverrides();

			foreach (ManagementPackOverride mpOverride in overrides)
			{
				Console.WriteLine("Override name: " + mpOverride.Name);
				if (mpOverride.ContextInstance == null)
				{
					// The context is a class.
					try
					{
						MonitoringClass mc = mg.GetMonitoringClass(mpOverride.Context.Id);
						Console.WriteLine("	Override context (class): " + mc.Name);

				}
					catch (ObjectNotFoundException)
					{
						Console.WriteLine("	Override context: Not Found.");
				}
			}
				else
				{
					// The context is a monitoring object or group.
					PartialMonitoringObject partialObject =
						mg.GetPartialMonitoringObject(mpOverride.ContextInstance.Value);

					Console.WriteLine("	Override context (instance): " + partialObject.Name);
			}
		}
	}
}
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP

Target Platforms

Windows Server 2008,Windows Server 2003,Windows Vista,Windows XP

See Also