Пример #1
0
        private Task ClearPageCache(Guid siteId, Guid pageId)
        {
            return(Task.Run(() =>
            {
                foreach (var language in _languageFacade.GetAllActive(siteId))
                {
                    _cacheManager.Remove(string.Format(CacheKeys.PageInfoCacheKey, siteId, pageId, language.Id));
                }

                _cacheManager.Remove(string.Format(CacheKeys.PageInfoCacheKey, siteId, pageId, Guid.Empty));
            }));
        }
Пример #2
0
        private Task ClearCache(Guid siteId, string name)
        {
            return(Task.Run(() =>
            {
                foreach (var language in _languageFacade.GetAllActive(siteId))
                {
                    _cacheManager.Remove(string.Format(CacheKeys.MenuCacheKey, siteId, name, language.Id));
                }

                _cacheManager.Remove(string.Format(CacheKeys.MenuCacheKey, siteId, name, Guid.Empty));
            }));
        }
Пример #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory loggerFactory,
                              ISiteInstallationService siteInstallationService,
                              IAppInstallationService appInstallationService,
                              IMembershipInstallationService membershipInstallationService,
                              ISiteRepository siteRepository,
                              ILanguageFacade languageFacade,
                              IPageFacade pageFacade)
        {
            appInstallationService.VerifyAppInstallation();
            siteInstallationService.VerifySiteInstallation();
            membershipInstallationService.VerifyUserCreation();

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseApplicationInsightsRequestTelemetry();

            app.UseStatusCodePagesWithRedirects("~/error/{0}");

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/error/500");
            }

            app.UseApplicationInsightsExceptionTelemetry();

            app.UseStaticFiles();

            app.UseIdentity();

            // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715

            var site            = siteRepository.GetByName("Default");
            var activeLanguages = languageFacade.GetAllActive(site.Id);
            var pages           = pageFacade.GetAllForAdminAsync(site.Id).Result;

            app.AddRoutes(site, activeLanguages, pages);
            app.AddLocalisation(activeLanguages);
        }
Пример #4
0
        public LanguageInfo GetCurrentLanguageInfo()
        {
            return(GetInfo(LanguageInfoKey, () =>
            {
                var languages = _languageFacade.GetAllActive(GetCurrentSiteInfo().Id);
                var userCulture = _httpContextAccessor.HttpContext.Request.Cookies[CookieRequestCultureProvider.DefaultCookieName];

                if (!string.IsNullOrEmpty(userCulture))
                {
                    var userLanguage = languages.FirstOrDefault(x => x.CultureName == userCulture);

                    if (userLanguage != null)
                    {
                        return userLanguage;
                    }
                }

                return languages.Any() ? languages.FirstOrDefault() : new LanguageInfo();
            }));
        }
Пример #5
0
        public async Task <IViewComponentResult> InvokeAsync(string viewName = "Default")
        {
            var languages = await Task.Run(() => _languageFacade.GetAllActive(SiteId));

            return(View(viewName, languages));
        }