parameterValue elementΒΆ

Element parameterValue is used to reference a parameter value in auto-implemented method of auto-generated service.

This element can be used only under elements if or default under element autoMethod.

Note

Refer to Autogenerated Services for more details on auto-generated services.

The element uses an attribute paramName to reference the parameter of auto-generated method. A parameter with this name should be declared under element ../autoService/autoMethod/methodSignature.

An example below demonstrated an example of using an element parameterValue.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<autoGeneratedServices>
  <!--Demo of referencing auto-implemented method parameters using
      parameterValue element-->
  <autoService
    interface="IoC.Configuration.Tests.AutoService.Services.IAppInfoFactory">

    <autoMethod name="CreateAppInfo"
                returnType="IoC.Configuration.Tests.AutoService.Services.IAppInfo">
      <methodSignature>
        <int32 paramName="appId"/>
        <string paramName="appDescription"/>
      </methodSignature>

      <default>
        <constructedValue
            type="IoC.Configuration.Tests.AutoService.Services.AppInfo">
          <parameters>
            <!--The value of name attribute is the name of constructor parameter
                in AppInfo-->
            <!--
            The value of paramName attribute is the name of parameter in
            IAppInfoFactory.CreateAppInfo.
            This parameter should be present under autoMethod/methodSignature element.
            -->
            <!--In this example the values of name and paramName are similar, however
                they don't have to be.-->
            <parameterValue name="appId" paramName="appId" />
            <parameterValue name="appDescription" paramName="appDescription" />
          </parameters>
        </constructedValue>
      </default>
    </autoMethod>
  </autoService>
</autoGeneratedServices>