RuleValidation Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Validates expression conditions.
public ref class RuleValidation
public class RuleValidation
type RuleValidation = class
Public Class RuleValidation
- Inheritance
-
RuleValidation
Examples
The following code creates an invalid condition. It then attempts to validate the condition, and displays any errors that result.
// Create an invalid condition ("abc" < true).
CodeBinaryOperatorExpression invalidCompare = new CodeBinaryOperatorExpression();
invalidCompare.Left = new CodePrimitiveExpression("abc");
invalidCompare.Operator = CodeBinaryOperatorType.LessThan;
invalidCompare.Right = new CodePrimitiveExpression(true);
RuleExpressionCondition condition = new RuleExpressionCondition();
condition.Expression = invalidCompare;
// Create a validator for this condition.
// We are not using "this" in the condition, so the type is not used.
RuleValidation validation = new RuleValidation(this.GetType(), null);
// See whether the condition validates.
if (!condition.Validate(validation))
{
// There were errors, so display them.
foreach (ValidationError error in validation.Errors)
{
Console.WriteLine(error.ErrorText);
}
}
Running this code produces the following error:
Relational operator "LessThan" cannot be used on operands of types "string" and "bool".
Constructors
RuleValidation(Activity, ITypeProvider, Boolean) |
Initializes a new instance of the RuleValidation class using the specified Activity and the type provider. |
RuleValidation(Type, ITypeProvider) |
Initializes a new instance of the RuleValidation class using the Type of the Rule. |
Properties
Errors |
Gets the errors associated with the RuleValidation. |
ThisType |
Gets the type of object. |
Methods
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
ExpressionInfo(CodeExpression) |
Determines the type of the code expression. |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
PopParentExpression() |
Removes and returns the parent expressions at the top of the Stack. |
PushParentExpression(CodeExpression) |
Inserts an object at the top of the Stack. |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Applies to
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示