0
我已通過添加如何捕捉PLINQO中的BrokenRuleException?
static partial void AddSharedRules()
{
RuleManager.AddShared<Tag>(
new CustomRule<String>(
"TagName",
"Invalid Tag Name, must be between 1 and 50 characters",
IsNullEmptyOrLarge));
}
到我的實體類創建自定義規則。
我再補充規則(如看到的視頻,雖然視頻是過時的,有錯誤的信息):
public static bool IsNullEmptyOrLarge(string value)
{
return (value == null
|| String.IsNullOrEmpty(value)
|| value.Length > 50);
}
但現在我有調用代碼...
try
{
// some code
}
catch (CodeSmith.Data.Rules… ???)
{
// I can’t add the BrokenRuleException object. It’s not on the list.
}
我有:分配,安全和驗證。
在PLINQO中捕獲違規規則異常的正確方法是什麼?
太好了,現在我已經得到了價格是正確的主題曲停留在我的頭上。 – 2009-11-30 19:52:31