Partager via


TSqlModel.ConvertToScriptedObject(TSqlObject, String) Method

Definition

Converts a specific top-level object in the model into a scripted representation of itself. This is useful when starting from a database sourced model and the caller wishes to modify this object's contents.

public Microsoft.SqlServer.Dac.Model.TSqlObject ConvertToScriptedObject (Microsoft.SqlServer.Dac.Model.TSqlObject tSqlObject, string sourceName);
member this.ConvertToScriptedObject : Microsoft.SqlServer.Dac.Model.TSqlObject * string -> Microsoft.SqlServer.Dac.Model.TSqlObject
Public Function ConvertToScriptedObject (tSqlObject As TSqlObject, sourceName As String) As TSqlObject

Parameters

tSqlObject
TSqlObject

Object to convert. Must not be null

sourceName
String

Optional source name. If left null a default name will be generated for the object. This name can be found using GetSourceInformation()'s SourceName property.

Returns

New copy of the TSqlObject, which will now be script-backed. Or if the object was already script-backed, will simply return this object

Exceptions

Thrown if the object could not be scripted out, this class of object is never scriptable, or errors were found in the model during the script process

If the oject is null, or if whitespace is used for the source name

Applies to