Share via


Developing Managed Code Response Assemblies

A managed code response can call public methods in any assembly. The assembly can belong to the product being monitored or a common class library, or you can create your own assemblies specifically for use in MOM responses.

Managed code responses impose several requirements on the assemblies and methods they call. For more information about the requirements, see Requirements for Managed Code Responses.

If the response requires information about the alert or event that it is responding to, you must include a method parameter that will accept a Microsoft.EnterpriseManagement.Mom.Runtime.Context object. If you must call an assembly that does not include a parameter for the Context object, you can create and call a wrapper method that does accept a Context object. The wrapper method, in turn, can call the code in the assembly that is not MOM-aware.

The following example demonstrates a simple class and method that would be suitable for running as a managed code response:

using Microsoft.EnterpriseManagement.Mom;
using Microsoft.EnterpriseManagement.Mom.Runtime;

namespace MyMCRs
{
    class MomAwareMCRs
    {
        public static void MomAwareTest(Context momContext)
        {
        }
    }

    class CommonMCRs
    {
        public static void Test()
        {
        }
    }
}