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


C# Accessor.GetValue方法代码示例

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


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

示例1: Validate

 public void Validate(Accessor accessor, ValidationContext context)
 {
     var enumerable = accessor.GetValue(context.Target) as System.Collections.IEnumerable;
     if (enumerable == null || enumerable.Count() != _length)
     {
         context.Notification.RegisterMessage(accessor, ValidationKeys.COLLECTION_LENGTH).AddSubstitution(LENGTH, _length.ToString());
     }
 }
开发者ID:Jakobsson,项目名称:fubumvc,代码行数:8,代码来源:CollectionLengthRule.cs

示例2: Validate

 public void Validate(Accessor accessor, ValidationContext context)
 {
     var value = accessor.GetValue(context.Target);
     if(_bounds.CompareTo(value) < 0)
     {
         context.Notification.RegisterMessage(accessor, Token, TemplateValue.For("bounds", _bounds));
     }
 }
开发者ID:jrios,项目名称:fubuvalidation,代码行数:8,代码来源:MaxValueFieldRule.cs

示例3: Validate

 public void Validate(Accessor accessor, ValidationContext context)
 {
     var enumerable = accessor.GetValue(context.Target) as System.Collections.IEnumerable;
     if (enumerable == null || enumerable.Count() != _length)
     {
         context.Notification.RegisterMessage(accessor, ValidationKeys.CollectionLength, TemplateValue.For(LENGTH, _length));
     }
 }
开发者ID:thunklife,项目名称:fubuvalidation,代码行数:8,代码来源:CollectionLengthRule.cs

示例4: Validate

 public void Validate(Accessor accessor, ValidationContext context)
 {
     var rawValue = accessor.GetValue(context.Target);
     if (rawValue != null && rawValue.ToString().Length > Length)
     {
         context.Notification.RegisterMessage(accessor, Token, TemplateValue.For(LENGTH, _length));
     }
 }
开发者ID:jrios,项目名称:fubuvalidation,代码行数:8,代码来源:MaximumLengthRule.cs

示例5: Validate

        public void Validate(Accessor accessor, ValidationContext context)
        {
            var rawValue = accessor.GetValue(context.Target);

            if (rawValue == null || string.Empty.Equals(rawValue))
            {
                context.Notification.RegisterMessage(accessor, ValidationKeys.Required);
            }
        }
开发者ID:thunklife,项目名称:fubuvalidation,代码行数:9,代码来源:RequiredFieldRule.cs

示例6: Validate

 public void Validate(Accessor accessor, ValidationContext context)
 {
     var rawValue = accessor.GetValue(context.Target);
     if (rawValue == null || string.IsNullOrWhiteSpace(rawValue.ToString()) || rawValue.ToString().Length < Length)
     {
         context.Notification.RegisterMessage(accessor, ValidationKeys.MAX_LENGTH)
             .AddSubstitution(LENGTH, _length.ToString());
     }
 }
开发者ID:taylonr,项目名称:fubuvalidation,代码行数:9,代码来源:MinimumLengthRule.cs

示例7: Validate

		public void Validate(Accessor accessor, ValidationContext context)
		{
			var items = (IEnumerable<StringWrapper>)accessor.GetValue(context.Target);

			if (items.Any(i => i.Text.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)))
			{
				var m = prefix + " is not a valid prefix for \""+ GetFormattedPropertyName(accessor)  + "\"";
				var em = StringToken.FromKeyString("", m);
				context.Notification.RegisterMessage(accessor, em);
			}
		}
开发者ID:NTCoding,项目名称:FubuRaven.NTCoding.com,代码行数:11,代码来源:DenyPrefixRule.cs

示例8: Validate

        public void Validate(Accessor accessor, ValidationContext context)
        {
            var rawValue = accessor.GetValue(context.Target);
            if (rawValue == null) return;

            var value = Convert.ToDecimal(rawValue);
            if (value <= 0)
            {
                context.Notification.RegisterMessage(accessor, ValidationKeys.GreaterThanZero);
            }
        }
开发者ID:thunklife,项目名称:fubuvalidation,代码行数:11,代码来源:GreaterThanZeroRule.cs

示例9: Validate

 public void Validate(Accessor accessor, ValidationContext context)
 {
     var rawValue = accessor.GetValue(context.Target);
     if (rawValue != null)
     {
         var value = Convert.ToDouble(rawValue);
         if (value < 0)
         {
             context.Notification.RegisterMessage(accessor, Token);
         }
     }
 }
开发者ID:RyanHauert,项目名称:fubumvc,代码行数:12,代码来源:GreaterOrEqualToZeroRule.cs

示例10: Validate

 public void Validate(Accessor accessor, ValidationContext context)
 {
     var rawValue = accessor.GetValue(context.Target);
     if (rawValue != null)
     {
         var value = Convert.ToDouble(rawValue);
         if (value < 0)
         {
             context.Notification.RegisterMessage(accessor, ValidationKeys.GREATER_OR_EQUAL_TO_ZERO);
         }
     }
 }
开发者ID:Jakobsson,项目名称:fubumvc,代码行数:12,代码来源:GreaterOrEqualToZeroRule.cs

示例11: FormatProperty

 /// <summary>
 /// Retrieves the formatted value of a property from an instance
 /// </summary>
 /// <param name="formatter">The formatter</param>
 /// <param name="modelType">The type of the model to which the property belongs (i.e. Case where the property might be on its base class WorkflowItem)</param>
 /// <param name="property">The property of <paramref name="entity"/> whose value should be formatted</param>
 /// <param name="entity">The instance containing the data to format</param>
 public static string FormatProperty(this IDisplayFormatter formatter, Type modelType, Accessor property, object entity)
 {
     var raw = property.GetValue(entity);
     return formatter.FormatValue(modelType, property, raw);
 }
开发者ID:nieve,项目名称:fubucore,代码行数:12,代码来源:DisplayFormatter.cs

示例12: GetDisplayForProperty

 public static string GetDisplayForProperty(this IDisplayFormatter formatter, Accessor accessor, object target)
 {
     return formatter.GetDisplay(accessor, accessor.GetValue(target));
 }
开发者ID:nieve,项目名称:fubucore,代码行数:4,代码来源:DisplayFormatter.cs

示例13: GetterFor

 public Func<object> GetterFor(Accessor accessor)
 {
     return () => accessor.GetValue(_currentRow);
 }
开发者ID:DarthFubuMVC,项目名称:FubuFastPack,代码行数:4,代码来源:EntityGridData.cs


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