Analysis Service Class
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(TSqlModel) are not supported. However it is possible to call Cancel() from a thread while a separate thread is waiting on the Analyze(TSqlModel) method to complete.
public sealed class CodeAnalysisService
type CodeAnalysisService = class
Public NotInheritable Class CodeAnalysisService
The CancellationToken used to indicate whether execution should be canceled.
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.
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(String) can be used to output the results after analysis has completed.
Determines the validation performed on the model prior to code analysis. This can be used to bypass the requirement that a TSqlModel be valid prior to analysis by a code analysis rule.
Performs the analysis of the model. This will initialize all required resources, run analysis and report back results to the caller.
Applies the specified rule settings against the service's configuration.
Cancels execution of the analysis service
Gets any errors that may have occurred during loading of the analysis rules. This causes rules to be loaded by the service.
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.
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.