Best Practice: Expression Type must be explicitly defined for 'more' or 'less' comparisons


What does this best practice check for?

When building management packs, it is often necessary to build custom modules. These custom modules will have certain configurable parameters that are necessary to get the correct data or end-result from the module. As a best practice, configurable parameters should have data types explicitly defined that correspond to their values.

Why is it important to follow this best practice? What is the impact of not following this best practice?

The data type of a value can affect how it is interpreted in a module, and having the wrong type can drastically change the intended effect. When doing a comparison of two values, comparing two values as strings that were intended to be interpreted as integers could produce the wrong result.

How do I fix this?

Using the Authoring Console:

1.        For all modules, open the Properties dialog. In the Configuration Parameters tab, ensure that the data type for each parameter is defined, and the intended type.

Using XML:

< DataSourceModuleType ID = " Microsoft.Windows.Server.2008.CPUUtilization.ModuleType" Accessibility =" Internal" >

       < Configuration >

          < xsd:element name = " IntervalSeconds" type =" xsd:int" />

          < xsd:element name = " TargetComputerName" type =" xsd:string" />

          < xsd:element name = " NumSamples" type =" xsd:int" />

          < xsd:element name = " CounterName" type =" xsd:string" />

          < xsd:element name = " ObjectName" type =" xsd:string" />

          < xsd:element name = " InstanceName" type =" xsd:string" />

          < xsd:element name = " AllInstances" type =" xsd:boolean" />

       </ Configuration >


     </ DataSourceModuleType >