Value Initialization ElementsΒΆ
Value initialization elements are elements that are used to specify values in different contexts. Some examples are using elements like int32, constructedValue, injectedObject, object, or constructedValue to specify constructor parameter value, or a value to returned in autoMethod or autoProperty elements.
Value initialization elements normally have attributes or child elements to specify the value, and might have some additional attributes, based on the type of the element and the context, where the element is used.
For example, if the value initialization element is used to specify injected property or constructor parameter value, the element should have a name attribute, to specify the constructor parameter or property name.
On the other hand, if the element is used to specify a returned value in autoMethod or autoProperty element, no name attribute should be present.
- Predefined Type Value Initializer Elements
- object element
- injectedObject element
- collection element
- Example 1: Using collection element to specify constructed parameter value in service implementation
- Example 2: Using collection element to specify injected property value
- Example 3: Using collection element to specify a returned value for auto-generated method
- Example 4: Using collection element to provide a service implementation
- constructedValue element
- Example 1: Using constructedValue element to define a setting of type IoC.Configuration.Tests.ConstructedValue.Services.AppInfo
- Example 2: Using constructedValue element to define a service implementation
- Example 3: Using constructedValue element to specify a value returned in autoProperty element
- Example 4: Using constructedValue element to specify a value returned in autoMethod element
- Example 5: Using constructedValue element as a parameter value in another constructedValue element
- settingValue element
- Example 1: Using settingValue element to provide a service implementation
- Example 2: Using settingValue element in collection element
- Example 3: Using settingValue element to specify constructor parameter and injected property values
- Example 4: Referencing setting values in autoMethod and autoProperty elements
- Example 5: Referencing setting value in if element under autoMethod element
- classMember element
- Referencing non-static and non-constant class members
- Example 1: Using classMember to provide a service implementation
- Example 2: Using classMember in collection element
- Example 3: Using classMember to specify a returned value in autoProperty element
- Example 3: Referencing class member in if element under autoMethod element
- Example 3: Using classMember to call methods with parameters
- parameterValue element