本文整理汇总了C#中IPropertyValidator类的典型用法代码示例。如果您正苦于以下问题:C# IPropertyValidator类的具体用法?C# IPropertyValidator怎么用?C# IPropertyValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPropertyValidator类属于命名空间,在下文中一共展示了IPropertyValidator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetRules
/// <summary>
/// Get the <see cref="ModelValidationRule"/> instances that are mapped from the fluent validation rule.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="ModelValidationRule"/> instances.</returns>
public override IEnumerable<ModelValidationRule> GetRules(PropertyRule rule, IPropertyValidator validator)
{
yield return new ModelValidationRule(
"Custom",
base.FormatMessage(rule, validator),
base.GetMemberNames(rule));
}
开发者ID:Borzoo,项目名称:Nancy,代码行数:11,代码来源:FallbackAdapter.cs
示例2: Create
/// <summary>
/// Creates a <see cref="IFluentAdapter"/> instance based on the provided <paramref name="propertyValidator"/>.
/// </summary>
/// <param name="propertyValidator">The <see cref="IPropertyValidator"/> for which the adapter should be created.</param>
/// <returns>An <see cref="IFluentAdapter"/> instance.</returns>
public IFluentAdapter Create(IPropertyValidator propertyValidator)
{
var adapter =
this.adapters.SingleOrDefault(x => x.CanHandle(propertyValidator));
return adapter ?? new FallbackAdapter();
}
开发者ID:Borzoo,项目名称:Nancy,代码行数:12,代码来源:DefaultFluentAdapterFactory.cs
示例3: PropertyType
public PropertyType(int key, IPropertyValidator propertyValidator, GroupTypeCollection groupsRead, GroupTypeCollection groupsWrite)
{
Key = key;
Validator = propertyValidator;
GroupsReadInternal = groupsRead;
GroupsWriteInternal = groupsWrite;
}
开发者ID:invertedtomato,项目名称:Amos3,代码行数:7,代码来源:PropertyType.cs
示例4: GetRules
/// <summary>
/// Get the <see cref="ModelValidationRule"/> instances that are mapped from the fluent validation rule.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="ModelValidationRule"/> instances.</returns>
public override IEnumerable<ModelValidationRule> GetRules(PropertyRule rule, IPropertyValidator validator)
{
yield return new RegexValidationRule(
FormatMessage(rule, validator),
GetMemberNames(rule),
((IRegularExpressionValidator)validator).Expression);
}
开发者ID:RadifMasud,项目名称:Nancy,代码行数:11,代码来源:RegularExpressionAdapter.cs
示例5: GeneratorFrom
public Rule GeneratorFrom(string propertyName, IPropertyValidator propertyValidator)
{
return new Required
{
Message = propertyValidator.GetErrorMessageFor(propertyName)
};
}
开发者ID:LenFon,项目名称:Bifrost,代码行数:7,代码来源:RequiredGenerator.cs
示例6: DataAnnotationsValidatorFixture
public DataAnnotationsValidatorFixture()
{
this.propertyValidator1 =
A.Fake<IPropertyValidator>();
this.propertyValidator2 =
A.Fake<IPropertyValidator>();
this.validatableObjectAdapter =
A.Fake<IValidatableObjectAdapter>();
this.validatorFactory =
A.Fake<IPropertyValidatorFactory>();
A.CallTo(() => this.validatorFactory.GetValidators(typeof(ModelUnderTest)))
.Returns(new[] { this.propertyValidator1, this.propertyValidator2 });
this.validator =
new DataAnnotationsValidator(typeof(ModelUnderTest), this.validatorFactory, this.validatableObjectAdapter);
var adapterFactory = new DefaultPropertyValidatorFactory(new IDataAnnotationsValidatorAdapter[]
{
new RangeValidatorAdapter(),
new RegexValidatorAdapter(),
new RequiredValidatorAdapter(),
new StringLengthValidatorAdapter(),
new OopsAdapter()
});
var adapter = A.Fake<IValidatableObjectAdapter>();
this.factory = new DataAnnotationsValidatorFactory(adapterFactory, adapter);
}
开发者ID:uliian,项目名称:Nancy,代码行数:33,代码来源:DataAnnotationsValidatorFixture.cs
示例7: GeneratorFrom
public Rule GeneratorFrom(IPropertyValidator propertyValidator)
{
return new Required
{
Message = propertyValidator.ErrorMessageSource.GetString()
};
}
开发者ID:TormodHystad,项目名称:Bifrost,代码行数:7,代码来源:RequiredGenerator.cs
示例8: GeneratorFrom
public Rule GeneratorFrom(IPropertyValidator propertyValidator)
{
return new LessThanOrEqual
{
Value = ((LessThanOrEqualValidator)propertyValidator).ValueToCompare,
Message = propertyValidator.ErrorMessageSource.GetString()
};
}
开发者ID:JoB70,项目名称:Bifrost,代码行数:8,代码来源:LessThanOrEqualGenerator.cs
示例9: GeneratorFrom
public Rule GeneratorFrom(IPropertyValidator propertyValidator)
{
var emailRule = new Email
{
Message = propertyValidator.ErrorMessageSource.GetString()
};
return emailRule;
}
开发者ID:JoB70,项目名称:Bifrost,代码行数:8,代码来源:EmailGenerator.cs
示例10: GetRules
/// <summary>
/// Get the <see cref="ModelValidationRule"/> instances that are mapped from the fluent validation rule.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="ModelValidationRule"/> instances.</returns>
public override IEnumerable<ModelValidationRule> GetRules(PropertyRule rule, IPropertyValidator validator)
{
yield return new ComparisonValidationRule(
base.FormatMessage(rule, validator),
base.GetMemberNames(rule),
ComparisonOperator.LessThan,
((LessThanValidator)validator).ValueToCompare);
}
开发者ID:RadifMasud,项目名称:Nancy,代码行数:12,代码来源:LessThanAdapter.cs
示例11: GeneratorFrom
public Rule GeneratorFrom(string propertyName, IPropertyValidator propertyValidator)
{
return new GreaterThanOrEqual
{
Value = ((GreaterThanOrEqualValidator)propertyValidator).ValueToCompare,
Message = propertyValidator.GetErrorMessageFor(propertyName)
};
}
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:8,代码来源:GreaterThanOrEqualGenerator.cs
示例12: RequiredFluentValidationPropertyValidator
public RequiredFluentValidationPropertyValidator(ModelMetadata metadata, ControllerContext controllerContext, PropertyRule rule, IPropertyValidator validator)
: base(metadata, controllerContext, rule, validator)
{
bool isNonNullableValueType = !TypeAllowsNullValue(metadata.ModelType);
bool nullWasSpecified = metadata.Model == null;
ShouldValidate = isNonNullableValueType && nullWasSpecified;
}
开发者ID:henriksoerensen,项目名称:FluentValidation,代码行数:8,代码来源:RequiredFluentValidationPropertyValidator.cs
示例13: GeneratorFrom
public Rule GeneratorFrom(string propertyName, IPropertyValidator propertyValidator)
{
var emailRule = new Email
{
Message = propertyValidator.GetErrorMessageFor(propertyName)
};
return emailRule;
}
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:8,代码来源:EmailGenerator.cs
示例14: GeneratorFrom
public Rule GeneratorFrom(string propertyName, IPropertyValidator propertyValidator)
{
return new LessThan
{
Value = ((LessThanValidator)propertyValidator).ValueToCompare,
Message = propertyValidator.GetErrorMessageFor(propertyName)
};
}
开发者ID:jarlef,项目名称:Bifrost,代码行数:8,代码来源:LessThanGenerator.cs
示例15: GeneratorFrom
public Rule GeneratorFrom(IPropertyValidator propertyValidator)
{
return new GreaterThan
{
Value = ((GreaterThanValidator)propertyValidator).ValueToCompare,
Message = propertyValidator.ErrorMessageSource.GetString()
};
}
开发者ID:JoB70,项目名称:Bifrost,代码行数:8,代码来源:GreaterThanGenerator.cs
示例16: GetRules
/// <summary>
/// Get the <see cref="ModelValidationRule"/> instances that are mapped from the fluent validation rule.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="ModelValidationRule"/> instances.</returns>
public override IEnumerable<ModelValidationRule> GetRules(PropertyRule rule, IPropertyValidator validator)
{
yield return new StringLengthValidationRule(
base.FormatMessage(rule, validator),
base.GetMemberNames(rule),
((ILengthValidator)validator).Min,
((ILengthValidator)validator).Max);
}
开发者ID:RadifMasud,项目名称:Nancy,代码行数:12,代码来源:LengthAdapter.cs
示例17: FormatMessage
/// <summary>
/// Get the formatted error message of the validator.
/// </summary>
/// <returns>A formatted error message string.</returns>
protected virtual Func<string, string> FormatMessage(PropertyRule rule, IPropertyValidator validator)
{
return displayName =>
{
return new MessageFormatter()
.AppendPropertyName(displayName ?? rule.GetDisplayName())
.BuildMessage(validator.ErrorMessageSource.GetString());
};
}
开发者ID:jbattermann,项目名称:Nancy,代码行数:13,代码来源:AdapterBase.cs
示例18: SimpleUnitaryClientSideValidator
public SimpleUnitaryClientSideValidator(ModelMetadata metadata,
ControllerContext controllerContext,
PropertyRule rule,
IPropertyValidator validator,
string validationType)
: base(metadata, controllerContext, rule, validator)
{
_validationType = validationType;
}
开发者ID:Gwayaboy,项目名称:MVCSolutionSample,代码行数:9,代码来源:SimpleUnitaryClientSideValidator.cs
示例19: GeneratorFrom
public Rule GeneratorFrom(string propertyName, IPropertyValidator propertyValidator)
{
return new Length
{
Min = ((ILengthValidator)propertyValidator).Min,
Max = ((ILengthValidator)propertyValidator).Max,
Message = propertyValidator.GetErrorMessageFor(propertyName)
};
}
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:9,代码来源:LengthGenerator.cs
示例20: GeneratorFrom
public Rule GeneratorFrom(IPropertyValidator propertyValidator)
{
var rule = new Regex
{
Message = propertyValidator.ErrorMessageSource.GetString(),
Expression = ((IRegularExpressionValidator)propertyValidator).Expression
};
return rule;
}
开发者ID:JoB70,项目名称:Bifrost,代码行数:9,代码来源:RegexGenerator.cs
注:本文中的IPropertyValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论