本文整理汇总了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());
}
}
示例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));
}
}
示例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));
}
}
示例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));
}
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
示例12: GetDisplayForProperty
public static string GetDisplayForProperty(this IDisplayFormatter formatter, Accessor accessor, object target)
{
return formatter.GetDisplay(accessor, accessor.GetValue(target));
}
示例13: GetterFor
public Func<object> GetterFor(Accessor accessor)
{
return () => accessor.GetValue(_currentRow);
}