Dela via


Scripter Class

The Scripter object is the overall, top-level object for managing scripting operations.

Inheritance Hierarchy

System.Object
  Microsoft.SqlServer.Management.Smo.DependencyWalker
    Microsoft.SqlServer.Management.Smo.Scripter

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Syntax

'Declaration
Public Class Scripter _
    Inherits DependencyWalker
'Usage
Dim instance As Scripter
public class Scripter : DependencyWalker
public ref class Scripter : public DependencyWalker
type Scripter =  
    class
        inherit DependencyWalker
    end
public class Scripter extends DependencyWalker

The Scripter type exposes the following members.

Constructors

  Name Description
Public method Scripter() Initializes a new instance of the Scripter class.
Public method Scripter(Server) Initializes a new instance of the Scripter class on the specified instance of SQL Server.

Top

Properties

  Name Description
Protected property DependencyTree Gets or sets a server Dependency Tree. (Inherited from DependencyWalker.)
Public property FilterCallbackFunction Gets or sets the scripting options that allow URNs to be filtered out while running the DiscoverDependencies method. (Inherited from DependencyWalker.)
Protected property KnownObjectsList Gets or sets a list of all known objects in a server. (Inherited from DependencyWalker.)
Public property Options Gets or sets the scripting options for the Scripter object and all the scripting operations on the instance of SQL Server.
Public property PrefetchObjects Gets or sets the Boolean property value that specifies whether the objects are loaded before scripting operations, or only as they are required.
Public property Server Gets or sets the instance of Microsoft SQL Server that the DependencyWalker tool object is associated with. (Inherited from DependencyWalker.)
Protected property Total Gets or sets the number of objects that have been processed by the DependencyWalker() object. (Inherited from DependencyWalker.)
Protected property TotalCount Gets or set the count of objects discovered by a Dependency Walker. (Inherited from DependencyWalker.)

Top

Methods

  Name Description
Public method DiscoverDependencies(array<SqlSmoObject[], DependencyType) Creates a hierarchical object tree that represents the parent or child dependent relationships for a specified object array of SQL Server objects on the instance of SQL Server. (Inherited from DependencyWalker.)
Public method DiscoverDependencies(array<SqlSmoObject[], Boolean) Creates a hierarchical object tree that represents the parent or child dependent relationships for a specified object array of SQL Server objects on the instance of SQL Server. (Inherited from DependencyWalker.)
Public method DiscoverDependencies(array<Urn[], DependencyType) Creates a hierarchical object tree that represents the parent- or child-dependent relationships for a specified Urn array of SQL Server objects on the instance of SQL Server. (Inherited from DependencyWalker.)
Public method DiscoverDependencies(array<Urn[], Boolean) Creates a hierarchical object tree that represents the parent- or child-dependent relationships for a specified Urn array of SQL Server objects on the instance of SQL Server. (Inherited from DependencyWalker.)
Public method DiscoverDependencies(UrnCollection, DependencyType) Creates a hierarchical object tree that represents the parent or child dependent relationships for a specified Urn collection of SQL Server objects on the instance of SQL Server. (Inherited from DependencyWalker.)
Public method DiscoverDependencies(UrnCollection, Boolean) Creates a hierarchical object tree that represents the parent or child dependent relationships for a specified Urn collection of SQL Server objects on the instance of SQL Server. (Inherited from DependencyWalker.)
Public methodStatic member EnumDependencies Returns an enumerated list that includes the specified object and child or parent dependencies.
Public method EnumScript(array<SqlSmoObject[]) Returns an IEnumerable<script> object that contains a script.
Public method EnumScript(array<Urn[]) Returns an IEnumerable <script> interface.
Public method EnumScript(UrnCollection) Returns an IEnumerable <script> interface.
Public method EnumScriptWithList(DependencyCollection) Creates a linear Transact-SQL script based on a dependency collection.
Public method EnumScriptWithList(array<SqlSmoObject[]) Creates a linear Transact-SQL script based on an array of SqlSmoObjects.
Public method EnumScriptWithList(array<Urn[]) Creates a linear Transact-SQL script that is based on an array of URNs.
Public method EnumScriptWithList(UrnCollection) Creates a linear Transact-SQL script based on a URN collection.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Protected method GetServerObject Returns the Server object that represents the instance of SQL Server on which the dependency discovery operation is running. (Inherited from DependencyWalker.)
Public method GetType (Inherited from Object.)
Protected method Init Initializes the Scripter object.
Protected method MemberwiseClone (Inherited from Object.)
Public method Script(array<SqlSmoObject[]) Generates Transact-SQL scripts that can be used to re-create a list of objects.
Public method Script(array<Urn[]) Creates a Transact-SQL script for a set of objects that are specified with an array of Urn objects.
Public method Script(UrnCollection) Creates a Transact-SQL script for a set of objects that are specified with a Urn object collection.
Public method ScriptWithList(DependencyCollection) Creates linear Transact-SQL scripts for a DependencyCollection object. 
Public method ScriptWithList(array<SqlSmoObject[]) Creates linear Transact-SQL scripts for an array of SqlSmoObject objects. 
Public method ScriptWithList(array<Urn[]) Creates linear Transact-SQL scripts for an array of Urn objects. 
Public method ScriptWithList(UrnCollection) Creates linear Transact-SQL scripts for a UrnCollection object. 
Public method ToString (Inherited from Object.)
Public method WalkDependencies Creates a linear list of objects and their dependencies from a specified DependencyTree object. (Inherited from DependencyWalker.)

Top

Events

  Name Description
Public event DiscoveryProgress Raises an event at intervals and reports progress on the DiscoveryProgress method. (Inherited from DependencyWalker.)
Public event ScriptingError Raises an event when an error occurs during a scripting operation.
Public event ScriptingProgress Raises an event to receive information about the progress of the scripting operation.

Top

Remarks

The Scripter object allows programmatic access to scripting settings and is responsible for the following scripting functionality:

  • Finding dependencies.

  • Output script to memory and file.

  • Calling the instance objects to be scripted.

  • Managing context of a script operation, such as checking whether an object has already been scripted.

To get Scripter object properties, users can be a member of the public fixed server role.

To set Scripter object properties, users can be a member of the public fixed server role.

To run a script operation, users require permissions for the objects that are being scripted.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Examples

Scripting

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.