Before you begin: Before creating a new class you need to decide on a class ID and a display name. You should also think about if your class should have any properties.
For more information, consult the MP Content document, section Class naming.
If the project is not open in Visual Studio, open it.
Right-click the project name in the solution explorer and choose
Add\New folder. The name of the folder should be same as the description part of the Class ID. So if the full Class ID is
MyCompany.TestMP.3.0.ExportServiceApplicationComponent.Class, the folder would be named
Right-click the new folder and choose
In the list, select
Empty Management Pack Fragment.
Enter a name for the fragment. This should be the same as the folder you created before. Click
Add. The fragment is created and opened.
Right-click between the
<ManagementPackFragment> tags and select
MPDevToolkit\Classes\Application Component. Depending on how many properties the class should have, choose the corresponding Computer Role snippet.
Pick one without the dependency monitor. If you want a dependency monitor, there's a seperate snippet/guide for that.
The code is inserted.
Enter the MPID and press
Enter the class name. This is the description part of the class ID and should be the same as the folder you created.
If you have choosen a snippet for a class with one or more properties, do the following step for each property. Otherwise, skip this step and continue with Source Class Name.
Enter the name of the property and press
tab. Choose a type for the property. If it is a string, just press
tab. Otherwise, press
Backspace and then press
Ctrl-Space. A list of possible types are shown. Pick one and press
Repeat this for each property.
Enter the description part of the name for the source class for the relationship. This is the class that is hosting the application component. The name entered here is only used to clarify the relationship. It's not used to create the relationship.
For example, if the application component is to be hosted by the
WindowsComputer. Or if you created another class called
IntegrationServerComputerRole. Or remove the base class from the description and just enter 'IntegrationServer'. All of these examples makes it fairly easy to understand which class is the source class.
Enter the class ID of the source class. This is the full ID of the source class and is used to create the relationship. To use intellisense, press
Backspace and then
Enter the Class display name you decided on earlier. Press
tab. Enter a class description. Press
If you have choosen a snippet for a class with one or more properties, do the following step for each property. Otherwise, skip this and continue to the last step.
The property name is automatically entered as display name. But enter a short description of the property and press
tab. Repeat this for each property.
enter to stop editing the snippet. The class has now been created.
Save the file/project.