Partager via


SqlRuleProblem Class

Definition

Describes a problem found by a rule during analysis. Contains relevant information such as the Rule that found the problem, the SqlObject causing the problem, the severity, and the error message to display.

Source position information (source name, start line and column) are initially inferred based on the ModelElement and Fragment passed into the constructor. Note that if a Fragment is passed in then the start line/column for that TSqlFragment will be used (if present), otherwise the TSqlObject's values will be used (if present). Note that certain models such as those generated from a dacpac may not have source position information.

public sealed class SqlRuleProblem
type SqlRuleProblem = class
Public NotInheritable Class SqlRuleProblem
Inheritance
SqlRuleProblem

Constructors

SqlRuleProblem(String, TSqlObject, TSqlFragment)

Constructs a new SqlRuleProblem. Source position information (source name, start line and column) is inferred based on the modelElement and fragment parameters, as long as this information is present in the model.

SqlRuleProblem(String, TSqlObject)

Constructs a new SqlRuleProblem. Source position information (source name, start line and column) is inferred based on the modelElement parameter, as long as this information is present in the model.

Properties

Description

Problem description

ErrorMessageString

The string for displaying the error message, based on rule information and the problem description

Fragment

TSqlFragment causing the problem

ModelElement

The TSqlObject causing the current problem

RuleId

Id of the rule that created this SqlRuleProblem

Severity

The severity of this problem, can be error, warning.

SourceName

Name of the source this problem was found in. This is determined based on the model element passed into the constructor. May be null if no source information was available. For instance models loaded from Dacpac files may not have source information available

StartColumn

The column the problem begins at, if known

StartLine

The line the problem begins at, if known

Methods

SetSourceInformation(SourceInformation)

Sets source position information (source name, start line and column) for this SqlRuleProblem, overriding any position information inferred when the rule was created.

Applies to