Share via


TSqlModelUtils Class

Definition

Provides utility methods for the public model APIs.

public static class TSqlModelUtils
type TSqlModelUtils = class
Public Class TSqlModelUtils
Inheritance
TSqlModelUtils

Methods

CalculatePlatformCompatibility(SqlServerVersion)

Maps from a SqlServerVersion to the TSqlPlatformCompatibility enum that matches it. The platform compatibility can be used to filter out extensions that don't support that platform, for instance code analysis rules.

TryGetFragmentForAnalysis(TSqlObject, TSqlFragment)

Tries to get the most suitable TSqlFragment for use during the rule analysis process. If the TSqlObject was originally built from a scripted source then the original source fragment will be returned.

Otherwise a new AST will be generated from the tSqlObject.

This ensures that when reporting SqlRuleProblems the most accurate source information can be included in the error messages.

Note that a fragment will only be returned if this is supported for the TSqlObject. AST generation is only supported for top-level objects, with certain objects such as the DatabaseOptions and inline constraints not supporting AST generation even though they are top level types.

Applies to