Exemple #1
0
        public HelixDependencyConfigurationProvider(XmlNode configNode)
        {
            if (configNode == null)
            {
                return;
            }

            var layers = configNode.ChildNodes.OfType <XmlElement>()
                         .Where(node => node.NodeType == XmlNodeType.Element && node.Name.Equals("layer"));

            foreach (var layer in layers)
            {
                Layers.Add(XmlActivator.CreateObject <IHelixLayer>(layer));
            }

            foreach (var helixLayer in Layers)
            {
                var dependencies = helixLayer.DependsOn?.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                if (dependencies != null)
                {
                    foreach (var dependency in dependencies)
                    {
                        var dep = Layers.FirstOrDefault(p =>
                                                        p.Name.Equals(dependency, StringComparison.InvariantCultureIgnoreCase));
                        helixLayer.DependentLayers.Add(dep as HelixLayer);
                    }
                }
            }
        }
        public CerberusVariablesReplacer(XmlNode configNode)
        {
            var replacerNodes = configNode.ChildNodes.OfType <XmlElement>()
                                .Where(nd => nd.NodeType == XmlNodeType.Element && nd.Name.Equals("replacer"));

            var ruleInstances = new List <IContainerDefinitionVariablesReplacer>();

            foreach (var node in replacerNodes)
            {
                var type = XmlActivator.GetType(node);

                ruleInstances.Add(
                    XmlActivator.CreateInstance(type, node, new IContainer[] { }) as
                    IContainerDefinitionVariablesReplacer);
            }

            _replacerCollection = ruleInstances.ToArray();
        }