/// <summary> /// Get elements of this instance. /// </summary> /// <returns>IQueryable{Element}.</returns> public IQueryable <Element> Elements() { if (!_cacheRepository.Elements().Any()) { using (var _repository = _repositoryFactory.GetRepositoryInstance()) { // limit languages by Language setting; var languageSetting = _repository.Settings.Where(s => s.Name.Contains("Lang")) .Expand(s => s.SettingValues) .FirstOrDefault(); // the expression is: (x=>x.LanguageCode == "en-US" || x.LanguageCode == "ja-JP" || ....) var parameter = linq.Expression.Parameter(typeof(Localization), "x"); linq.Expression condition = linq.Expression.Constant(false); foreach (var name in languageSetting.SettingValues) { condition = linq.Expression.OrElse( condition, linq.Expression.Equal( linq.Expression.Property(parameter, "LanguageCode"), linq.Expression.Constant(name.ShortTextValue))); } var expression = linq.Expression.Lambda <Func <Localization, bool> >(condition, parameter); var query = GetLocalizationsEnumerable(_repository).Where(expression); foreach (var loc in query) { //Update cache with items _cacheRepository.Add(GetElement(loc)); } } } return(_cacheRepository.Elements()); }
private void DoClearCache() { var confirmation = new ConditionalConfirmation { Title = "Refresh locally cached Commerce Manager texts".Localize(), Content = "Are you sure you want to clear all locally cached Commerce Manager texts?".Localize() }; CommonConfirmRequest.Raise(confirmation, async xx => { if (xx.Confirmed) { ShowLoadingAnimation = true; try { await Task.Run(() => { _elementRepository.Clear(); // force Elements re-caching _elementRepository.Elements(); _elementRepository.SetStatusDate(); // force values update LocalizationManager.UpdateValues(); // update available languages menu SendCulturesToShell(); }); var notification = new Notification(); // notification.Title = "Done"; notification.Content = "All locally cached texts were removed. You may need to restart this application for the changes to take effect." .Localize(); CommonNotifyRequest.Raise(notification); } finally { ShowLoadingAnimation = false; } } }); }
public IQueryable <Element> Elements() { return(inner.Elements()); }
/// <summary> /// Elementses this instance. /// </summary> /// <returns></returns> public IEnumerable <Element> Elements() { return(inner.Elements()); }
/// <summary> /// Elements of this instance. /// </summary> /// <returns>IQueryable{Element}.</returns> public IQueryable <Element> Elements() { return(_innerRepository.Elements()); }