public SettingsResult SaveSettings(List <Setting> Settings) { var result = new SettingsResult { Settings = Settings }; try { InitCusRelContext(); foreach (var addOrUpdateResult in Settings.Select(AddOrUpdate)) { result.MergeResults(addOrUpdateResult); if (!addOrUpdateResult.OK) { break; } } // Implement distributed cache instead since this application will be load balanced //if (DomainCache.GetCache(_THISCONTEXTCACHEKEYNAME) != null) // DomainCache.Remove(_THISCONTEXTCACHEKEYNAME); } catch (Exception e) { result.SetFail(e); } return(result); }
public SettingsResult GetSettings(Setting FilterBy = null) { SettingsResult cusRelSettingsResult = new SettingsResult(); try { // Implement distributed cache instead since this application will be load balanced //var cusRelSettings = DomainCache.GetCache(_THISCONTEXTCACHEKEYNAME) as List<Setting>; //if (cusRelSettings == null) //{ // InitCusRelContext(); // if (cusRelContext.Settings != null && cusRelContext.Settings.Count() > 0) // { // cusRelSettings = cusRelContext.Settings.ToList().FromEntities(); // DomainCache.AddCache(_THISCONTEXTCACHEKEYNAME, cusRelSettings); // } //} InitCusRelContext(); var cusRelSettings = cusRelContext.Settings.ToList().FromEntities(); if (FilterBy != null) { cusRelSettings = cusRelSettings.Where(s => (FilterBy.GroupdId.HasValue && s.GroupdId.Value.Equals(FilterBy.GroupdId.Value) || (FilterBy.Name != null && s.Name.Equals(FilterBy.Name)) || (FilterBy.Value != null && s.Value.Equals(FilterBy.Value)))).ToList(); } cusRelSettingsResult.Settings = cusRelSettings; } catch (Exception e) { cusRelSettingsResult.SetFail(e); } return(cusRelSettingsResult); }