TSqlModelUtils.TryGetFragmentForAnalysis(TSqlObject, TSqlFragment) Method

Definition

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.

public static bool TryGetFragmentForAnalysis (Microsoft.SqlServer.Dac.Model.TSqlObject tSqlObject, out Microsoft.SqlServer.TransactSql.ScriptDom.TSqlFragment fragment);
static member TryGetFragmentForAnalysis : Microsoft.SqlServer.Dac.Model.TSqlObject * TSqlFragment -> bool
Public Shared Function TryGetFragmentForAnalysis (tSqlObject As TSqlObject, ByRef fragment As TSqlFragment) As Boolean

Parameters

tSqlObject
TSqlObject

The TSqlObject whose fragment is being requested

fragment
TSqlFragment

The TSqlFragment for the tSqlObject, if it is possible to get fragment information for the object

Returns

true if the fragment was obtained, false otherwise.

Applies to