This documentation is archived and is not being maintained.

Microsoft.SqlServer.Dac.CodeAnalysis Namespace

SQL Server 2014
 

Updated: April 20, 2017

Provides classes related to code analysis.

ClassDescription
System_CAPS_pubclassCodeAnalysisResult

Represents the results of Code Analysis against a particular model. Will include any SqlRuleProblems found, in addition to any errors that occurred during analysis.

System_CAPS_pubclassCodeAnalysisRuleSettings

Represents the settings used to configure rules used during analysis. Before analysis begins, this settings object will be applied to the rules discovered by the analysis service. If DisableRule is set to true then any rules not included in these settings will be disabled and not run during analysis.

These settings are applied by calling the ApplySettingsToRules method on rules returned by the engine.

System_CAPS_pubclassCodeAnalysisService

A service that runs code analysis against a model and provides results to the caller. Note that this class is not thread-safe since multiple simulataneous calls to Analyze are not supported. However it is possible to call Cancel from a thread while a separate thread is waiting on the Analyze method to complete.

System_CAPS_pubclassCodeAnalysisServiceFactory

Represents a factory class that supports creation of CodeAnalysisService objects.

System_CAPS_pubclassCodeAnalysisServiceSettings

Defines the optional configuration settings for a CodeAnalysisService. This can determine which rules are run, how to suppress certain problems, and where to save results to. These settings can also be set on the CodeAnalysisService after it has been created, but are included here to make construction more convenient.

System_CAPS_pubclassExportCodeAnalysisRuleAttribute

Represents an attribute defining a rule export, and the metadata about that rule. Implements ISqlAnalysisRuleMetadata, which should be used on the importer side to ensure type consistency.

System_CAPS_pubclassProblemSuppressionException

Represents an exception that occurred when running the rule problem suppression test.

System_CAPS_pubclassProjectProblemSuppressor

Represents the problem suppressor used by SSDT projects. The ShouldSuppressProblem method can be passed to ShouldSuppressProblem in order to use this class. This reads suppression information from a file with a name matching SuppressionFilename ("StaticCodeAnalysis.SuppressMessages.xml") in the root directory. All relative paths will be resolved relative to the project folder defined in the constructor.

System_CAPS_pubclassRuleConfiguration

Specifies how a rule should be configured - should this be enabled or disabled? What severity should be applied for the rule?

System_CAPS_pubclassRuleDescriptor

Describes a rule discovered by the rule engine and supports configuration of its properties. Descriptors inherit properties from RuleConfiguration, to support enabling/disabling the rule during analysis and specifying the severity for problems created by the rule. This class is not intended to be subclasses by external users - instances of RuleDescriptor are created by the analysis service.

System_CAPS_pubclassRuleException

Represents an exception that may occur during a code analysis run.

System_CAPS_pubclassSqlAnalysisRule

Represents a base class for all types of analysis rule. An analysis rule analyzes a model / model element and returns a list of problems found during analysis.

System_CAPS_pubclassSqlCodeAnalysisRule

Represents a base class for SQL static code analysis rules. An analysis rule analyzes a model / model element and returns a list of problems found during analysis. Implementing classes must have a ExportCodeAnalysisRuleAttribute defined on the class definition to be discovered and used during code analysis.

System_CAPS_pubclassSqlRuleExecutionContext

Defines the fields necessary for analysis, including the schema model and model element to analyze.

System_CAPS_pubclassSqlRuleProblem

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.

System_CAPS_pubclassSqlRuleProblemSuppressionContext

The context information for suppressing a SCA problem

System_CAPS_pubclassSuppressedProblemInfo

Represents information about a problem being suppressed for a particular source. This information includes the source name and the rule whose problems should be suppressed.

InterfaceDescription
System_CAPS_pubinterfaceISqlAnalysisRuleMetadata

The metadata describing a rule - its namespace, id, scope etc.

EnumerationDescription
System_CAPS_pubenumCodeAnalysisModelValidationMode

System_CAPS_pubenumSqlRuleProblemSeverity

The type of message for reporting problems

System_CAPS_pubenumSqlRuleScope

The scope examined by a static code analysis rule.

Return to top
Show: