當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。