public PluginGraphBuilder(ConfigurationParser[] parsers, Registry[] registries, GraphLog log) { _parsers = parsers; _registries = registries; _graph = new PluginGraph(); _graph.Log = log; }
// Open for testing public static ConfigurationParser[] GetParsers(XmlNode node, GraphLog log) { var builder = new XmlConfiguration(); builder.IncludeNode(node, String.Empty); builder.IgnoreDefaultFile = true; return builder.GetParsers(log); }
// Only used in testing public static PluginGraph BuildFromXml(XmlDocument document) { var log = new GraphLog(); ConfigurationParser[] parsers = ConfigurationParserBuilder.GetParsers(document.DocumentElement, log); var builder = new PluginGraphBuilder(parsers, new Registry[0], log); return builder.Build(); }
public static PluginGraph GetDiagnosticPluginGraph(string fileName) { XmlDocument document = GetXmlDocument(fileName); var log = new GraphLog(); var builder = new PluginGraphBuilder(); builder.FindSource<XmlConfiguration>().IncludeNode(document.DocumentElement, "testing data"); return builder.Build(); }
public void ForEachFile(GraphLog log, Action<string> action) { string includePath = getIncludePath(); // Find the text in every child node of _structureMapNode and // perform an action with that text _structureMapNode.ForTextInChild("Include/@File").Do(fileName => { string includedFile = Path.Combine(includePath, fileName); action(includedFile); }); }
public void SetUp() { _log = new GraphLog(); builder = new ConfigurationParserBuilder(_log); DataMother.BackupStructureMapConfig(); }
private void addConfigurationFromExplicitlyAddedFiles(ICollection<ConfigurationParser> list, GraphLog log) { foreach (string filename in _otherFiles) { string absolutePath = locateFileAsAbsolutePath(filename); log.Try(() => { ConfigurationParser parser = ConfigurationParser.FromFile(absolutePath); parser.Description = absolutePath; list.Add(parser); }).AndReportErrorAs(160, absolutePath); } }
public void SetUp() { _log = new GraphLog(); builder = new XmlConfiguration(); DataMother.BackupStructureMapConfig(); }
private void setProfileDefaults(GraphLog log) { if (string.IsNullOrEmpty(_defaultProfileName)) { return; } if (!_profiles.ContainsKey(_defaultProfileName)) { log.RegisterError(280, _defaultProfileName); } Profile profile = getProfile(_defaultProfileName); profile.FillAllTypesInto(_default); }
public void SetUp() { log = new GraphLog(); registry = new Registry(); reader = new XmlInstanceReader(log, registry); }
public XmlInstanceReader(GraphLog log, Registry registry) { _log = log; _registry = registry; }
private void addConfigurationFromIncludeNodes(List<ConfigurationParser> list, GraphLog log) { foreach (ConfigurationParser parser in list.ToArray()) { parser.ForEachFile(log, filename => log.Try(() => { ConfigurationParser childParser = ConfigurationParser.FromFile(filename); list.Add(childParser); }) .AndReportErrorAs(150, filename)); } }
private void addConfigurationFromStructureMapConfig(ICollection<ConfigurationParser> list, GraphLog log) { if (_ignoreDefaultFile && !_useAndEnforceExistenceOfDefaultFile) return; // Pick up the configuration in the default StructureMap.config string pathToStructureMapConfig = GetStructureMapConfigurationPath(); if ((_useAndEnforceExistenceOfDefaultFile || File.Exists(pathToStructureMapConfig))) { log.Try(() => { ConfigurationParser parser = ConfigurationParser.FromFile(pathToStructureMapConfig); list.Add(parser); }).AndReportErrorAs(100, pathToStructureMapConfig); } }
internal TryAction(Action action, GraphLog log) { _action = action; _log = log; }
private void addConfigurationFromApplicationConfigFile(GraphLog log) { if (_pullConfigurationFromAppConfig) { log.Try(() => { IList<XmlNode> appConfigNodes = StructureMapConfigurationSection.GetStructureMapConfiguration(); foreach (XmlNode appConfigNode in appConfigNodes) { IncludeNode(appConfigNode, String.Empty); } }).AndLogAnyErrors(); } }
public ConfigurationParser[] GetParsers(GraphLog log) { var list = new List<ConfigurationParser>(); addConfigurationFromStructureMapConfig(list, log); addConfigurationFromExplicitlyAddedFiles(list, log); addConfigurationFromApplicationConfigFile(log); list.AddRange(_parsers); addConfigurationFromIncludeNodes(list, log); return list.ToArray(); }
public ConfigurationParserBuilder(GraphLog log) { _log = log; }
internal TryAction(Action action, GraphLog log) { _action = action; _log = log; }