/// <summary> /// Handles the attribute. /// </summary> /// <param name="value">The value of the attribute.</param> /// <param name="owner">The owner of this instance.</param> /// <param name="syntax">The binding syntax.</param> public override void Process( string value, IOwnXmlNodeProcessor owner, IBindingConfigurationSyntax <object> syntax) { syntax.Named(value); }
/// <summary> /// Handles the attribute. /// </summary> /// <param name="value">The value of the attribute.</param> /// <param name="owner">The owner of this instance.</param> /// <param name="syntax">The binding syntax.</param> public override void Process( string value, IOwnXmlNodeProcessor owner, IBindingConfigurationSyntax<object> syntax) { syntax.Named(value); }
/// <summary> /// Gets the relevant processors. /// </summary> /// <typeparam name="TNodeType">The type of the node type.</typeparam> /// <param name="owner">The owner.</param> /// <param name="nodeProcessors">The node processors.</param> /// <returns>The relevant processors for the given owner.</returns> private static Dictionary <string, TNodeType> GetRelevantProcessors <TNodeType>( IOwnXmlNodeProcessor owner, IEnumerable <TNodeType> nodeProcessors) where TNodeType : IXmlNodeProcessor { return(nodeProcessors .Where(processor => processor.AppliesTo(owner)) .ToDictionary(processor => processor.XmlNodeName)); }
/// <summary> /// Processes the specified element. /// </summary> /// <param name="element">The element that shall be processed.</param> /// <param name="owner">The owner of this instance.</param> /// <param name="syntax">The binding syntax.</param> public override void Process( XElement element, IOwnXmlNodeProcessor owner, IBindingConfigurationSyntax <object> syntax) { XAttribute keyAttribute = element.RequiredAttribute("key"); XAttribute valueAttribute = element.RequiredAttribute("value"); syntax.WithMetadata(keyAttribute.Value, valueAttribute.Value); }
/// <summary> /// Handles the attribute. /// </summary> /// <param name="value">The value of the attribute.</param> /// <param name="owner">The owner of this instance.</param> /// <param name="syntax">The binding syntax.</param> /// <exception cref="XmlException">An unknown scope value was found.</exception> public override void Process( string value, IOwnXmlNodeProcessor owner, IBindingConfigurationSyntax <object> syntax) { if (this.scopeHandlers.TryGetValue(value, out IScopeHandler scopeHandler)) { scopeHandler.SetScope(syntax); } else { throw new XmlException(this.GetInvalidScopeErrorMessage(value, owner.XmlNodeName)); } }
/// <summary> /// Handles the attribute. /// </summary> /// <param name="value">The value of the attribute.</param> /// <param name="owner">The owner of this instance.</param> /// <param name="syntax">The binding syntax.</param> /// <exception cref="ConfigurationErrorsException">An unknown scope value was found.</exception> public override void Process( string value, IOwnXmlNodeProcessor owner, IBindingConfigurationSyntax<object> syntax) { IScopeHandler scopeHandler; if (this.scopeHandlers.TryGetValue(value, out scopeHandler)) { scopeHandler.SetScope(syntax); } else { throw new ConfigurationErrorsException(this.GetInvalidScopeErrorMessage(value, owner.XmlNodeName)); } }
/// <summary> /// Processes the specified element. /// </summary> /// <param name="element">The element that shall be processed.</param> /// <param name="owner">The owner of this instance.</param> /// <param name="bindingSyntax">The binding syntax.</param> public abstract void Process( XElement element, IOwnXmlNodeProcessor owner, IBindingConfigurationSyntax <object> bindingSyntax);
/// <summary> /// Specifies if the processor applies to the given owner. /// </summary> /// <param name="owner">The owner.</param> /// <returns> /// True if the processor is a applicable processor for the specified owner. /// </returns> public virtual bool AppliesTo(IOwnXmlNodeProcessor owner) { return(owner.ElementTags.Contains(this.ownerTag)); }
/// <summary> /// Handles the attribute. /// </summary> /// <param name="value">The value of the attribute.</param> /// <param name="owner">The owner of this instance.</param> /// <param name="syntax">The binding syntax.</param> public abstract void Process( string value, IOwnXmlNodeProcessor owner, IBindingConfigurationSyntax <object> syntax);
/// <summary> /// Handles the attribute. /// </summary> /// <param name="value">The value of the attribute.</param> /// <param name="owner">The owner of this instance.</param> /// <param name="syntax">The binding syntax.</param> public abstract void Process( string value, IOwnXmlNodeProcessor owner, IBindingConfigurationSyntax<object> syntax);
/// <summary> /// Specifies if the processor applies to the given owner. /// </summary> /// <param name="owner">The owner.</param> /// <returns> /// True if the processor is a applicable processor for the specified owner. /// </returns> public bool AppliesTo(IOwnXmlNodeProcessor owner) { return owner.ElementTags.Contains(this.parentTag); }
/// <summary> /// Sets the owner. /// </summary> /// <param name="owner">The owner.</param> public void SetOwner(IOwnXmlNodeProcessor owner) { this.owner = owner; this.elementProcessors = GetRelevantProcessors(owner, this.allElementProcessors); this.attributeProcessors = GetRelevantProcessors(owner, this.allAttributeProcessors); }