当前位置: 首页>>代码示例>>C#>>正文


C# ISettingsManager.GetObjectSettings方法代码示例

本文整理汇总了C#中ISettingsManager.GetObjectSettings方法的典型用法代码示例。如果您正苦于以下问题:C# ISettingsManager.GetObjectSettings方法的具体用法?C# ISettingsManager.GetObjectSettings怎么用?C# ISettingsManager.GetObjectSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISettingsManager的用法示例。


在下文中一共展示了ISettingsManager.GetObjectSettings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadObjectSettings

		protected void LoadObjectSettings(ISettingsManager settingManager, object obj)
		{
			var haveSettingsObjects = obj.GetFlatListObjectsWithInterface<IHaveSettings>();
			foreach (var haveSettingsObject in haveSettingsObjects)
			{
				var entity = haveSettingsObject as Entity;
				if (entity != null && !entity.IsTransient())
				{
					var storedSettings = settingManager.GetObjectSettings(entity.GetType().Name, entity.Id);
					//Merge default settings and stored in db 
					if (haveSettingsObject.Settings != null)
					{
						var resultSettings = new List<SettingEntry>();
						foreach (var setting in haveSettingsObject.Settings)
						{
							var storedSetting = storedSettings.FirstOrDefault(x => x.Name == setting.Name);
							if (storedSetting != null)
							{
								resultSettings.Add(storedSetting);
							}
							else
							{
								resultSettings.Add(setting);
							}
						}
						haveSettingsObject.Settings = resultSettings;
					}
					else
					{
						haveSettingsObject.Settings = storedSettings;
					}
				}
			}
		}
开发者ID:alt-soft,项目名称:vc-community,代码行数:34,代码来源:ServiceBase.cs

示例2: LoadObjectSettings

		protected void LoadObjectSettings(ISettingsManager settingManager, object obj)
		{
            var haveSettingsObjects = obj.GetFlatObjectsListWithInterface<IHaveSettings>();

			foreach (var haveSettingsObject in haveSettingsObjects)
			{
				var entity = haveSettingsObject as Entity;

				if (entity != null && !entity.IsTransient())
				{
					var storedSettings = settingManager.GetObjectSettings(entity.GetType().Name, entity.Id);

                    // Replace in-memory settings with stored in database
					if (haveSettingsObject.Settings != null)
					{
						var resultSettings = new List<SettingEntry>();

						foreach (var setting in haveSettingsObject.Settings)
						{
                            var storedSetting = storedSettings.FirstOrDefault(x => x.Name == setting.Name);
                            if (storedSetting != null)
                            {
                                resultSettings.Add(storedSetting);
                            }
                            else
                            {
                                setting.Value = setting.DefaultValue;
                                resultSettings.Add(setting);
                            }
                        }
						haveSettingsObject.Settings = resultSettings;
					}
					else
					{
						haveSettingsObject.Settings = storedSettings;
					}
				}
			}
		}
开发者ID:rajendra1809,项目名称:VirtoCommerce,代码行数:39,代码来源:ServiceBase.cs


注:本文中的ISettingsManager.GetObjectSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。