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


C# IConfig.GetAttribute方法代码示例

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


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

示例1: Create

		private ILogManager Create(IConfig config) {
			var typeName = config.GetAttribute(ConfigSection, QualifiedNameAttribute);
			var manager = Create(typeName) as ILogManager;
			if(manager == null) {
				throw new TypeLoadException(string.Format("Type '{0}' is not an instance of '{1}'", typeName, typeof(ILogManager).FullName));
			}
			return manager;
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:8,代码来源:ConfigurableLogManagerFactory.cs

示例2: GetFormatter

		internal static IFormatter GetFormatter(IConfig config) {
			var formatters = new CompositeFormatter();
			string[] patterns = config.GetAttributeArray(".", "rule", "pattern");
			foreach(string pattern in patterns) {
				string replacement = config.GetAttribute(".", string.Format("rule[@pattern='{0}']", pattern), "replacement");
				bool caseSensitive = false;

				if(config.ContainsAttribute(".", string.Format("rule[@pattern='{0}']", pattern), "caseSensitive")) {
					caseSensitive = config.GetAttribute<bool>(".", string.Format("rule[@pattern='{0}']", pattern), "caseSensitive");
				}

				var rule = new Rule(pattern, replacement, caseSensitive);
				var ruleFormatter = new RegexFormatter(rule);

				formatters.Add(ruleFormatter);
			}
			return formatters;
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:18,代码来源:FormatterFactory.cs

示例3: SetAttributeDefinitionList

		private static void SetAttributeDefinitionList(IConfig configSection, UsersConfig users) {
			var containsCustomAttributes = configSection.ContainsKey("users", "attributes");
			var attributes = new List<IAttributeDefinition>(users.Attributes);
			if(containsCustomAttributes) {
				attributes.Clear();
			}
			attributes.Attach(users.EmailAttribute, true);
			attributes.Attach(users.CreationDateAttribute, true);
			attributes.Attach(users.LastLoginDateAttribute, true);
			attributes.Attach(users.LastPasswordChangedDateAttribute, true);
			attributes.Attach(users.DescriptionAttribute, true);
			attributes.Attach(users.MembershipAttribute, true);
			if(containsCustomAttributes) {
				var attributeValues = configSection.GetValueArray("users/attributes", "attribute");
				foreach(var attribute in attributeValues) {
					var excludeFromNameSearch = false;
					var attributeKey = String.Format("users/attributes/attribute[@value='{0}']", attribute);
					if(configSection.ContainsAttribute(attributeKey, "excludeFromNameSearch")) {
						excludeFromNameSearch = configSection.GetAttribute<bool>(attributeKey, "excludeFromNameSearch");
					}
					attributes.Attach(attribute, excludeFromNameSearch);
				}
			}
			users.Attributes = attributes;
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:25,代码来源:UsersConfigFactory.cs

示例4: GetPredefinedContextAttribute

		private static string GetPredefinedContextAttribute(string property, IConfig config) {
			string result = null;
			if(config.ContainsAttribute("predefinedProperties", property, "context")) {
				result = config.GetAttribute("predefinedProperties", property, "context");
			}
			return result;
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:7,代码来源:PredefinedNamesFactory.cs

示例5: SetAttributeDefinitionList

		private static void SetAttributeDefinitionList(IConfig configSection, GroupsConfig groups) {
			var containsCustomAttributes = configSection.ContainsKey("groups", "attributes");
			var attributes = new List<IAttributeDefinition>(groups.Attributes);
			if(containsCustomAttributes) {
				attributes.Clear();
			}
			attributes.Attach(groups.MembershipAttribute, true);
			if(containsCustomAttributes) {
				var attributeValues = configSection.GetValueArray("groups/attributes", "attribute");
				foreach(var attribute in attributeValues) {
					var excludeFromNameSearch = false;
					var attributeKey = String.Format("groups/attributes/attribute[@value='{0}']", attribute);
					if(configSection.ContainsAttribute(attributeKey, "excludeFromNameSearch")) {
						excludeFromNameSearch = configSection.GetAttribute<bool>(attributeKey, "excludeFromNameSearch");
					}
					attributes.Attach(attribute, excludeFromNameSearch);
				}
			}
			groups.Attributes = attributes;
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:20,代码来源:GroupsConfigFactory.cs


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