public SiteMapBuilderSetStrategy(ISiteMapBuilderSet[] siteMapBuilderSets)
        {
            if (siteMapBuilderSets == null)
                throw new ArgumentNullException(nameof(siteMapBuilderSets));

            this.siteMapBuilderSets = siteMapBuilderSets;
        }
        public SiteMap BuildSiteMap(ISiteMapBuilderSet builderSet, string cacheKey)
        {
            if (builderSet == null)
            {
                throw new ArgumentNullException(nameof(builderSet));
            }

            ISiteMapNodeProvider siteMapNodeProvider = null;
            var xmlDataSource = builderSet.DataSource as ISiteMapXmlDataSource;

            if (xmlDataSource != null)
            {
                siteMapNodeProvider = xmlSiteMapNodeProvider;

                if (siteMapNodeProvider == null)
                {
                    throw new Exception($"Provider of type {NodeProviderType.Xml} is not registered.");
                }
            }

            var jsonDataSource = builderSet.DataSource as ISiteMapJSONDataSource;

            if (jsonDataSource != null)
            {
                siteMapNodeProvider = jsonSiteMapNodeProvider;

                if (siteMapNodeProvider == null)
                {
                    throw new Exception($"Provider of type {NodeProviderType.Json} is not registered.");
                }
            }

            if (siteMapNodeProvider == null)
            {
                throw new Exception("No supported provider found.");
            }

            var siteMapNodes = siteMapNodeProvider.GetSiteMapNodes(builderSet.DataSource).ToList();

            // resolve other information regarding the sitemap nodes
            siteMapNodes.ForEach(ResolveUrl);

            return(new SiteMap
            {
                CacheKey = cacheKey ?? builderSet.BuilderSetName,
                Nodes = siteMapNodes
            });
        }
        public SiteMap BuildSiteMap(ISiteMapBuilderSet builderSet, string cacheKey)
        {
            if (builderSet == null)
                throw new ArgumentNullException(nameof(builderSet));

            ISiteMapNodeProvider siteMapNodeProvider = null;
            var xmlDataSource = builderSet.DataSource as ISiteMapXmlDataSource;
            if (xmlDataSource != null)
            {
                siteMapNodeProvider = xmlSiteMapNodeProvider;

                if (siteMapNodeProvider == null)
                    throw new Exception($"Provider of type {NodeProviderType.Xml} is not registered.");
            }

            var jsonDataSource = builderSet.DataSource as ISiteMapJSONDataSource;
            if (jsonDataSource != null)
            {
                siteMapNodeProvider = jsonSiteMapNodeProvider;

                if (siteMapNodeProvider == null)
                    throw new Exception($"Provider of type {NodeProviderType.Json} is not registered.");
            }

            if (siteMapNodeProvider == null)
                throw new Exception("No supported provider found.");

            var siteMapNodes = siteMapNodeProvider.GetSiteMapNodes(builderSet.DataSource).ToList();

            // resolve other information regarding the sitemap nodes
            siteMapNodes.ForEach(ResolveUrl);

            return new SiteMap
            {
                CacheKey = cacheKey ?? builderSet.BuilderSetName,
                Nodes = siteMapNodes
            };
        }
        /// <summary>
        /// Registers a builderset with the current configuration (This is for supporting multiple sitemap files)
        /// </summary>
        /// <param name="builderSet"></param>
        /// <returns></returns>
        public SiteMapConfiguration RegisterBuilderSet(ISiteMapBuilderSet builderSet)
        {
            builderSets.Add(builderSet);

            return(this);
        }
        /// <summary>
        /// Registers a builderset with the current configuration (This is for supporting multiple sitemap files)
        /// </summary>
        /// <param name="builderSet"></param>
        /// <returns></returns>
        public SiteMapConfiguration RegisterBuilderSet(ISiteMapBuilderSet builderSet)
        {
            builderSets.Add(builderSet);

            return this;
        }