Example #1
0
        public string GetCacheKey(INavigationTreeBuilder builder)
        {
            if (_cultureHelper.UseCultureRoutesAndProjects() && !_cultureHelper.IsDefaultCulture())
            {
                return(builder.Name + _currentSite.Id.ToString() + _cultureHelper.CurrentUICultureName());
            }

            return(builder.Name + _currentSite.Id.ToString());
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NavigationViewComponent"/> class.
        /// </summary>
        /// <param name="navigationTreeBuilder"></param>
        /// <param name="authorizationService"></param>
        /// <param name="loggerFactory"></param>
        public NavigationViewComponent([NotNull] INavigationTreeBuilder navigationTreeBuilder,
                                       [NotNull] IAuthorizationService authorizationService, [NotNull] ILoggerFactory loggerFactory)
        {
            Check.NotNull(navigationTreeBuilder, nameof(navigationTreeBuilder));
            Check.NotNull(authorizationService, nameof(authorizationService));
            Check.NotNull(loggerFactory, nameof(loggerFactory));

            _navigationTreeBuilder = navigationTreeBuilder;
            _authorizationService  = authorizationService;
            _loggerFactory         = loggerFactory;
        }
        public MemoryCacheNavigationTreeBuilder(
            INavigationTreeBuilder implementation,
            IMemoryCache cache,
            IOptions<MemoryCacheNavigationTreeBuilderOptions> optionsAccessor,
            INavigationCacheKeyResolver cacheKeyResolver,
            ILogger<MemoryCacheNavigationTreeBuilder> logger)
        {
            if (implementation == null) { throw new ArgumentNullException(nameof(implementation)); }
            if (implementation is MemoryCacheNavigationTreeBuilder) { throw new ArgumentException("implementation cannot be an instance of MemoryCacheNavigationTreeBuilder"); }
            if (cache == null) { throw new ArgumentNullException(nameof(cache)); }
            if (logger == null) { throw new ArgumentNullException(nameof(logger)); }
            if (optionsAccessor == null) { throw new ArgumentNullException(nameof(optionsAccessor)); }
            if (cacheKeyResolver == null) { throw new ArgumentNullException(nameof(cacheKeyResolver)); }

            this.implementation = implementation;
            this.cache = cache;
            log = logger;
            options = optionsAccessor.Value;
            this.cacheKeyResolver = cacheKeyResolver;
        }
 public NavigationViewComponent(
     INavigationTreeBuilder siteMapTreeBuilder,
     INavigationNodePermissionResolver permissionResolver,
     IUrlHelper urlHelper,
     INodeUrlPrefixProvider prefixProvider,
     ILogger <NavigationViewComponent> logger)
 {
     builder = siteMapTreeBuilder;
     this.permissionResolver = permissionResolver;
     this.urlHelper          = urlHelper;
     if (prefixProvider == null)
     {
         this.prefixProvider = new DefaultNodeUrlPrefixProvider();
     }
     else
     {
         this.prefixProvider = prefixProvider;
     }
     log = logger;
 }
 public NavigationViewComponent(
     INavigationTreeBuilder siteMapTreeBuilder,
     INavigationNodePermissionResolver permissionResolver,
     IUrlHelper urlHelper,
     INodeUrlPrefixProvider prefixProvider,
     ILogger<NavigationViewComponent> logger)
 {
     builder = siteMapTreeBuilder;
     this.permissionResolver = permissionResolver;
     this.urlHelper = urlHelper;
     if(prefixProvider == null)
     {
         this.prefixProvider = new DefaultNodeUrlPrefixProvider();
     }
     else
     {
         this.prefixProvider = prefixProvider;
     }
     log = logger;
 }
        public MemoryCacheNavigationTreeBuilder(
            INavigationTreeBuilder implementation,
            IMemoryCache cache,
            IOptions <MemoryCacheNavigationTreeBuilderOptions> optionsAccessor,
            INavigationCacheKeyResolver cacheKeyResolver,
            ILogger <MemoryCacheNavigationTreeBuilder> logger)
        {
            if (implementation == null)
            {
                throw new ArgumentNullException(nameof(implementation));
            }
            if (implementation is MemoryCacheNavigationTreeBuilder)
            {
                throw new ArgumentException("implementation cannot be an instance of MemoryCacheNavigationTreeBuilder");
            }
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (optionsAccessor == null)
            {
                throw new ArgumentNullException(nameof(optionsAccessor));
            }
            if (cacheKeyResolver == null)
            {
                throw new ArgumentNullException(nameof(cacheKeyResolver));
            }

            this.implementation = implementation;
            this.cache          = cache;
            log     = logger;
            options = optionsAccessor.Value;
            this.cacheKeyResolver = cacheKeyResolver;
        }
 public string GetCacheKey(INavigationTreeBuilder builder)
 {
     return(builder.Name + currentSite.Id.ToString());
 }
Example #8
0
 public Task <string> GetCacheKey(INavigationTreeBuilder builder)
 {
     return(Task.FromResult(builder.Name));
 }
 public string GetCacheKey(INavigationTreeBuilder builder)
 {
     return builder.Name + currentSite.Id.ToString();
 }
Example #10
0
 public string GetCacheKey(INavigationTreeBuilder builder)
 {
     return(builder.Name);
 }
 public string GetCacheKey(INavigationTreeBuilder builder)
 {
     return(builder.Name + _tenant.UniqueKey);
 }
        public Task <string> GetCacheKey(INavigationTreeBuilder builder)
        {
            var result = builder.Name + currentSite.Id.ToString();

            return(Task.FromResult(result));
        }