本文整理汇总了C#中IScope.ValidateMany方法的典型用法代码示例。如果您正苦于以下问题:C# IScope.ValidateMany方法的具体用法?C# IScope.ValidateMany怎么用?C# IScope.ValidateMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScope
的用法示例。
在下文中一共展示了IScope.ValidateMany方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Usage_Rule
static void Usage_Rule(Domain domain, IScope scope)
{
scope.Validate(domain.Property, "Property", StringIs.NotEmpty);
scope.Validate(domain.Value, "Value", Is.NotDefault);
scope.ValidateMany(domain.Properties, "Properties", StringIs.NotEmpty);
//scope.ValidateMany(domain.Values, "Values", 100, Is.NotDefault);
scope.ValidateMany(domain.Values, "Values", Is.NotDefault);
//scope.ValidateMany(domain.Values, "Values", 100, Is.NotDefault);
scope.Validate(() => domain.Property, StringIs.NotEmpty);
scope.Validate(() => domain.Value, Is.NotDefault);
// medium trust
scope.Validate(domain, d => d.Property, StringIs.NotEmpty);
scope.Validate(domain, d => d.Value, Is.NotDefault);
scope.ValidateMany(() => domain.Properties, StringIs.NotEmpty);
scope.ValidateMany(() => domain.Values, Is.NotDefault);
// medium trust
scope.ValidateMany(domain, d => d.Properties, StringIs.NotEmpty);
scope.ValidateMany(domain, d => d.Values, Is.NotDefault);
scope.ValidateInScope(domain, (domain1, scope1) => { });
scope.ValidateInScope(new[] {domain}, (domain1, scope1) => { });
}
示例2: ValidateModelExpression
static void ValidateModelExpression(Model model, IScope scope)
{
scope.Validate(model, m => m.Login, StringIs.ValidEmail);
scope.Validate(model, m => m.Name, StringIs.NotEmpty);
scope.ValidateMany(model, m => m.Logins, StringIs.ValidEmail);
scope.ValidateMany(model, m => m.Names, StringIs.NotEmpty);
}