/// <summary>
 /// Add a new element to the configuration section schema.
 /// </summary>
 /// <param name="tag">Tag name in the XML.</param>
 /// <param name="elementType">Type the tag maps to.</param>
 public override void AddElement(string tag, Type elementType)
 {
     if (typeof(ContainerConfiguringElement).IsAssignableFrom(elementType))
     {
         ExtensionElementMap.AddContainerConfiguringElement(prefix, tag, elementType);
     }
     else if (typeof(InjectionMemberElement).IsAssignableFrom(elementType))
     {
         ExtensionElementMap.AddInjectionMemberElement(prefix, tag, elementType);
     }
     else if (typeof(ParameterValueElement).IsAssignableFrom(elementType))
     {
         ExtensionElementMap.AddParameterValueElement(prefix, tag, elementType);
     }
     else
     {
         throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
                                                           Resources.InvalidExtensionElementType,
                                                           elementType.Name));
     }
 }
Esempio n. 2
0
            public override void AddElement(string tag, Type elementType)
            {
                Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(elementType, "elementType");

                if (typeof(ContainerConfiguringElement).IsAssignableFrom(elementType))
                {
                    ExtensionElementMap.AddContainerConfiguringElement(this.prefix, tag, elementType);
                }
                else if (typeof(InjectionMemberElement).IsAssignableFrom(elementType))
                {
                    ExtensionElementMap.AddInjectionMemberElement(this.prefix, tag, elementType);
                }
                else if (typeof(ParameterValueElement).IsAssignableFrom(elementType))
                {
                    ExtensionElementMap.AddParameterValueElement(this.prefix, tag, elementType);
                }
                else
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
                                                                      Constants.InvalidExtensionElementType,
                                                                      elementType.Name));
                }
            }