示例#1
0
        public virtual void Execute(XmlNode node)
        {
            var DataSourceNodes = node.SelectNodes("./DataSource");

            foreach (XmlNode DataSourceNode in DataSourceNodes)
            {
                var name = DataSourceNode.Attributes["Name"].Value;

                var path = DataSourceNode.SelectSingleNode("./Path")?.InnerXml;
                path = path ?? $"{Root.NamingConvention.Apply(name)}";
                if (!Path.IsPathRooted(path))
                {
                    path = Path.Combine(RootPath ?? string.Empty, path);
                }

                var overwrite = bool.Parse(DataSourceNode.Attributes["overwrite"]?.Value ?? bool.TrueString);

                DataSourceService.Create(name, ParentPath, path, overwrite);
                Root.DataSources.Add(name, $"{ParentPath}/{name}");
            }
        }