Spring.Objects.Factory.Support.ObjectDefinitionBuilder.AddConstructorArgReference C# (CSharp) Method

AddConstructorArgReference() public method

Adds a reference to the named object as a constructor argument.
public AddConstructorArgReference ( string objectName ) : ObjectDefinitionBuilder
objectName string Name of the object.
return ObjectDefinitionBuilder
        public ObjectDefinitionBuilder AddConstructorArgReference(string objectName)
        {
            return AddConstructorArg(new RuntimeObjectReference(objectName));
        }

Usage Example

Example #1
0
        /// <summary>The do parse.</summary>
        /// <param name="element">The element.</param>
        /// <param name="parserContext">The parser context.</param>
        /// <param name="builder">The builder.</param>
        protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
        {
            var connectionFactoryRef = element.GetAttribute(CONNECTION_FACTORY_ATTRIBUTE);

            // At least one of 'templateRef' or 'connectionFactoryRef' attribute must be set.
            if (string.IsNullOrWhiteSpace(connectionFactoryRef))
            {
                parserContext.ReaderContext.ReportFatalException(element, "A '" + CONNECTION_FACTORY_ATTRIBUTE + "' attribute must be set.");
            }

            if (!string.IsNullOrWhiteSpace(connectionFactoryRef))
            {
                // Use constructor with connectionFactory parameter
                builder.AddConstructorArgReference(connectionFactoryRef);
            }

            var attributeValue = element.GetAttribute(AUTO_STARTUP_ATTRIBUTE);
            if (!string.IsNullOrWhiteSpace(attributeValue))
            {
                builder.AddPropertyValue("AutoStartup", attributeValue);
            }
        }
All Usage Examples Of Spring.Objects.Factory.Support.ObjectDefinitionBuilder::AddConstructorArgReference