Ejemplo n.º 1
0
        private void attachPlugin(XmlElement pluginElement, PluginFamily family)
        {
            TypePath pluginPath  = TypePath.CreateFromXmlNode(pluginElement);
            string   concreteKey = pluginElement.GetAttribute(CONCRETE_KEY_ATTRIBUTE);

            string context = "creating a Plugin for " + family.PluginType.AssemblyQualifiedName;

            _builder.WithType(pluginPath, context, pluggedType =>
            {
                if (concreteKey == string.Empty)
                {
                    throw new StructureMapException(112, pluggedType.FullName);
                }

                Plugin plugin = family.AddPlugin(pluggedType, concreteKey);

                pluginElement.ForTextInChild("Setter/@Name").Do(prop => plugin.Setters.MarkSetterAsMandatory(prop));
            });
        }