Changing severity of businessrules for certain roles #3412
Unanswered
Chicagoan2016
asked this question in
Questions
Replies: 1 comment
-
Since my business rule inherit from CommonBusinessRule and it has the default rule severity of Error. public static RuleSeverity Severity { get; set; } Here is the class public abstract class CustomCommonBusinessRule : PropertyRule
{
/// <summary>
/// Gets or sets the severity for this rule.
/// </summary>
public static RuleSeverity Severity { get; set; }
/// <summary>
/// Creates an instance of the rule.
/// </summary>
/// <param name="primaryProperty">Primary property.</param>
protected CustomCommonBusinessRule(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty)
{
//Severity = RuleSeverity.Error;
}
/// <summary>
/// Creates an instance of the rule.
/// </summary>
protected CustomCommonBusinessRule()
{
//Severity = RuleSeverity.Error;
}
///<summary>
///You can set the Rule severity for different roles when you load the application.
///This can be done as soon as you load a user's role from database or AD
///</summary>
public static void SetRuleSeverity(RuleSeverity severity)
{
Severity = severity;
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is related to #3381
I am asked to look into changing severity of business/validation rules from Error to Warning for users in certain admin roles.
We have public property Severity in CommonBusinessRule class.
The idea of going to every rule's Execute method and changing context.AddErrorResult to context.AddWarningResult doesn't sound appealing : )
Kind Regards
Beta Was this translation helpful? Give feedback.
All reactions