public static SiteMapConfiguration Init(TimeSpan cacheDuration, bool enableSiteMapFile, bool securityTrimmingEnabled)
        {
            if (configuration != null)
            {
                throw new InvalidOperationException("Configuration has already been initialized");
            }

            configuration = new SiteMapConfiguration()
            {
                Container = new SiteMapContainer(),

                CacheDuration           = cacheDuration,
                EnableSiteMapFile       = enableSiteMapFile,
                SecurityTrimmingEnabled = securityTrimmingEnabled
            };

            return(configuration);
        }
        public static void RegisterServices(SiteMapConfiguration configuration)
        {
            if (configuration == null)
                throw new ArgumentNullException(nameof(configuration));

            var container = configuration.Container;

            // default service registration
            container
                    .Register(_ => container)
                    .Register<ISiteMapBuilder, SiteMapBuilder>()
                    .Register<ISiteMapCacheKeyGenerator, SiteMapCacheKeyGenerator>()
                    .Register<ISiteMapCacheKeyToBuilderSetMapper, SiteMapCacheKeyToBuilderSetMapper>()
                    .Register<ISiteMapBuilderSetStrategy, SiteMapBuilderSetStrategy>()
                    .Register<ISiteMapLoader, SiteMapLoader>()
                    .Register<IXmlSiteMapNodeProvider, XmlSiteMapNodeProvider>()
                    .Register<IJSONSiteMapNodeProvider, JSONSiteMapNodeProvider>()
                    .Register<IAclModule, AuthorizeAttributeAclModule>()
                    .Register<ICacheProvider<SiteMap>, InMemoryCacheProvider<SiteMap>>()
                    .Register<ISiteMapCache, SiteMapCache>();
        }
        public static void RegisterServices(SiteMapConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var container = configuration.Container;

            // default service registration
            container
            .Register(_ => container)
            .Register <ISiteMapBuilder, SiteMapBuilder>()
            .Register <ISiteMapCacheKeyGenerator, SiteMapCacheKeyGenerator>()
            .Register <ISiteMapCacheKeyToBuilderSetMapper, SiteMapCacheKeyToBuilderSetMapper>()
            .Register <ISiteMapBuilderSetStrategy, SiteMapBuilderSetStrategy>()
            .Register <ISiteMapLoader, SiteMapLoader>()
            .Register <IXmlSiteMapNodeProvider, XmlSiteMapNodeProvider>()
            .Register <IJSONSiteMapNodeProvider, JSONSiteMapNodeProvider>()
            .Register <IAclModule, AuthorizeAttributeAclModule>()
            .Register <ICacheProvider <SiteMap>, InMemoryCacheProvider <SiteMap> >()
            .Register <ISiteMapCache, SiteMapCache>();
        }
        public static SiteMapConfiguration Init(TimeSpan cacheDuration, bool enableSiteMapFile, bool securityTrimmingEnabled)
        {
            if (configuration != null)
                throw new InvalidOperationException("Configuration has already been initialized");

            configuration = new SiteMapConfiguration()
            {
                Container = new SiteMapContainer(),

                CacheDuration = cacheDuration,
                EnableSiteMapFile = enableSiteMapFile,
                SecurityTrimmingEnabled = securityTrimmingEnabled
            };

            return configuration;
        }