I’ve created a custom rule by adding the
static partial void AddSharedRules()
{
RuleManager.AddShared<Tag>(
new CustomRule<String>(
"TagName",
"Invalid Tag Name, must be between 1 and 50 characters",
IsNullEmptyOrLarge));
}
to my Entity class.
I then added the rule (as seen on the video, although the video is dated and has wrong information):
public static bool IsNullEmptyOrLarge( string value )
{
return (value == null
|| String.IsNullOrEmpty(value)
|| value.Length > 50);
}
But now I have the calling code…
try
{
// some code
}
catch ( CodeSmith.Data.Rules… ??? )
{
// I can’t add the BrokenRuleException object. It’s not on the list.
}
I have: assign, security and Validation.
What’s the correct way to catch broken rule exceptions in PLINQO?