Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 929 Bytes

xml-configuration-properties.md

File metadata and controls

31 lines (22 loc) · 929 Bytes

XML configuration properties

If you have parameters that are used by more than one component or you have a complex system configuration, you may use a properties node which allows you to centralize the configuration. For example:

<configuration>

    <properties>
        <port>10</port>
        <host>smtphost</host>
    </properties>

    <components>
        <component id="smtp.sender"
            service="Namespace.IEmailSender, AssemblyName"
            type="Namespace.SmtpMailSender, AssemblyName">

            <parameters>
                <port>#{port}</port>
                <host>#{host}</host>
            </parameters>

        </component>
    </components>

</configuration>

You can specify values to attributes using the same syntax.

Notice the #{propertyName} notation. This is non-surprisingly called property reference notation and it means use the value of property with given name.