Defining a Component Using the RDMI Interface

Previous Next

The following example shows how to define a .NET component that retrieves the value of environment variables.

1.In the Definer, select RDMI, dotNet Components from the Define menu.
2.Provide a name for your new component, in this case: ENV.
3.Define a method called GET with an associated physical method called "getvalue".
4.Define two parameters: an input parameter containing the name of the environment variable and a return parameter to contain the value of the environment variable.
5.Press Commit. USoft generates the C# stub in the Program Source field and it compiles this code.
6.USoft has generated a new class with the same name as the component name (ENV) and a method with the same name as the physical method(getvalue). The method has the same number and types of parameters as defined in the RDMI definition. The last thing you need to define is the implementation for this method. Change the default "OK" string to:
Environment.GetEnvironmentVariable(name).
7.Commit changes

At runtime when the .NET component is called, USoft compiles the source code ("just in time" (JIT) compilation), creates an instance of the class according to the component lifetime settings and executes the method call.

select env.get('windir')

MR_help0084