コード例 #1
0
 public PluginGraphBuilder(ConfigurationParser[] parsers, Registry[] registries, GraphLog log)
 {
     _parsers = parsers;
     _registries = registries;
     _graph = new PluginGraph();
     _graph.Log = log;
 }
コード例 #2
0
        // 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);
        }
コード例 #3
0
        // 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();
        }
コード例 #4
0
ファイル: DataMother.cs プロジェクト: satish860/StructureMap3
        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();
        }
コード例 #5
0
        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);
            });
        }
コード例 #6
0
 public void SetUp()
 {
     _log = new GraphLog();
     builder = new ConfigurationParserBuilder(_log);
     DataMother.BackupStructureMapConfig();
 }
コード例 #7
0
 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);
     }
 }
コード例 #8
0
 public void SetUp()
 {
     _log = new GraphLog();
     builder = new XmlConfiguration();
     DataMother.BackupStructureMapConfig();
 }
コード例 #9
0
ファイル: ProfileManager.cs プロジェクト: hp4711/structuremap
        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);
        }
コード例 #10
0
        public void SetUp()
        {
            log = new GraphLog();
            registry = new Registry();

            reader = new XmlInstanceReader(log, registry);
        }
コード例 #11
0
 public XmlInstanceReader(GraphLog log, Registry registry)
 {
     _log = log;
     _registry = registry;
 }
コード例 #12
0
 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));
     }
 }
コード例 #13
0
 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);
     }
 }
コード例 #14
0
 internal TryAction(Action action, GraphLog log)
 {
     _action = action;
     _log    = log;
 }
コード例 #15
0
 private void addConfigurationFromApplicationConfigFile(GraphLog log)
 {
     if (_pullConfigurationFromAppConfig)
     {
         log.Try(() =>
         {
             IList<XmlNode> appConfigNodes = StructureMapConfigurationSection.GetStructureMapConfiguration();
             foreach (XmlNode appConfigNode in appConfigNodes)
             {
                 IncludeNode(appConfigNode, String.Empty);
             }
         }).AndLogAnyErrors();
     }
 }
コード例 #16
0
        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();
        }
コード例 #17
0
 public ConfigurationParserBuilder(GraphLog log)
 {
     _log = log;
 }
コード例 #18
0
ファイル: GraphLog.cs プロジェクト: smerrell/structuremap
 internal TryAction(Action action, GraphLog log)
 {
     _action = action;
     _log = log;
 }