Class ModelElementRule<TElement>
Denotes a rule that is used to create model elements
public class ModelElementRule<TElement> : ElementRule<TElement> where TElement : IModelElement
Type Parameters
TElement
the type of elements to create
- Inheritance
-
ElementRule<TElement>ModelElementRule<TElement>
- Derived
- Inherited Members
Methods
GetReferenceString(TElement, ParseContext)
Gets the printed reference for the given object
protected override string GetReferenceString(TElement reference, ParseContext context)
Parameters
reference
TElementthe referenced object
context
ParseContextthe parse context
Returns
- string
a string representation
Validate(Func<TElement, string>, DiagnosticSeverity)
Instructs the rule to validate elements using the given validator method, revalidating after every parse run
protected void Validate(Func<TElement, string> validator, DiagnosticSeverity severity = DiagnosticSeverity.Error)
Parameters
validator
Func<TElement, string>a function to validate elements
severity
DiagnosticSeveritythe severity of errors
Validate(TElement, RuleApplication, ParseContext)
Validates the given semantic element
protected override void Validate(TElement element, RuleApplication ruleApplication, ParseContext context)
Parameters
element
TElementthe element that should be validated
ruleApplication
RuleApplicationthe rule application in the context of which validation is performed
context
ParseContextthe context in which validation is performed
ValidateIncrementally(Expression<Func<TElement, string>>, DiagnosticSeverity)
Instructs the rule to validate elements using the given validator method incrementally
protected void ValidateIncrementally(Expression<Func<TElement, string>> validatorExpression, DiagnosticSeverity severity = DiagnosticSeverity.Error)
Parameters
validatorExpression
Expression<Func<TElement, string>>a function to validate elements
severity
DiagnosticSeveritythe severity of errors