CodeAnalysisService Class
Updated: April 20, 2017
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.
Assembly: Microsoft.SqlServer.Dac.Extensions (in Microsoft.SqlServer.Dac.Extensions.dll)
| Name | Description | |
|---|---|---|
![]() | CancellationToken | The CancellationToken used to indicate whether execution should be canceled. |
![]() | CodeAnalysisSucceededFile | Optional path to a file that is created if analysis succeeds. This can be used to check whether analysis should be run or not - for instance if analyzing a dacpac, comparing the modification time for the dacpac versus the analysis success file can tell you whether the dacpac is more recent than the last analysis. |
![]() | ResultsFile | Optional path to a results file. If this is specified, the analysis service will save all results to an XML file at the end of analysis. If no file path is specified then this will not be done automatically, but SerializeResultsToXml can be used to output the results after analysis has completed. |
![]() | ValidationMode |
| Name | Description | |
|---|---|---|
![]() | Analyze(TSqlModel^) | Performs the analysis of the model. This will initialize all required resources, run analysis and report back results to the caller. If the ResultsFile and/or CodeAnalysisSucceededFile are specified then these will be deleted at the start of the analysis, and new files created at the end of the analysis |
![]() | ApplyRuleSettings(CodeAnalysisRuleSettings^) | Applies the specified rule settings against the service's configuration. |
![]() | Cancel() | Cancels execution of the analysis service |
![]() | Equals(Object^) | (Inherited from Object.) |
![]() | GetHashCode() | (Inherited from Object.) |
![]() | GetRuleLoadErrors() | Gets any errors that may have occurred during loading of the analysis rules. This causes rules to be loaded by the service. |
![]() | GetRules() | Gets the rules loaded by the service. The current state of these rules (enabled, disabled, rule problem severity) can be queried, as can information about the rule such as its ID and metadata. |
![]() | GetType() | (Inherited from Object.) |
![]() | SetProblemSuppressor(Predicate<SqlRuleProblemSuppressionContext^>^) | Sets the problem suppression predicate to be applied when suppressing rules. This is an optional feature that supports ignoring problems raised by a rule. The problem might be suppressed based on the element the problem was raised against, or the source that the problem was found in. |
![]() | ToString() | (Inherited from Object.) |
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

