を追加してカスタムルールを作成しました
static partial void AddSharedRules()
{
RuleManager.AddShared<Tag>(
new CustomRule<String>(
"TagName",
"Invalid Tag Name, must be between 1 and 50 characters",
IsNullEmptyOrLarge));
}
私のEntityクラスに。
次に、ルールを追加しました(ビデオには日付があり、間違った情報が含まれていますが、ビデオに表示されています)。
public static bool IsNullEmptyOrLarge( string value )
{
return (value == null
|| String.IsNullOrEmpty(value)
|| value.Length > 50);
}
しかし今、私は呼び出しコードを持っています…</ p>
try
{
// some code
}
catch ( CodeSmith.Data.Rules… ??? )
{
// I can’t add the BrokenRuleException object. It’s not on the list.
}
私が持っているのは、割り当て、セキュリティ、検証です。
PLINQOで違反したルールの例外をキャッチする正しい方法は何ですか?