Microsoft.SqlServer.Management.Common 命名空间

The [Microsoft.SqlServer.Management.Common] namespace contains classes that provide connection functionality to the other SQL Server management namespaces.

The Microsoft.SqlServer.Management.Common namespace contains the classes that are used to establish a connection to an instance of SQL Server 数据库引擎. The most important class in this namespace is the ServerConnection class. The ServerConnection object lets you manage the connection to the instance of the 数据库引擎. It is referenced by various classes in the other manageability namespaces.

The Microsoft.SqlServer.Management.Common namespace resides in the Microsoft.SqlServer.ConnectionInfo.dll assembly file.

By using the Microsoft.SqlServer.Management.Common namespace, you can do the following:

  • Connect to an instance of SQL Server.

  • Control the connection settings.

  • Run Transact-SQL statements directly.

  • Capture the Transact-SQL statements that are generated by the SMO program.

  • Manage transactions.

  说明
公共类 CapturedSql The CapturedSql class represents the Transact-SQL commands that are sent to the instance of SQL Server by way of the referenced connection. However, they are then redirected to a buffer instead of running immediately on the instance of SQL Server.
公共类 ChangePasswordFailureException The ChangePasswordFailureException class is an exception that is raised when an unsuccessful attempt is made to change the password of the login that establishes a connection with the instance of SQL Server by using SQL Server Authentication.
公共类 ConnectionCannotBeChangedException The ConnectionCannotBeChangedException class is an exception that is raised when an unsuccessful attempt is made to change the connection to the instance of Microsoft SQL Server.
公共类 ConnectionException The ConnectionException class is an exception that is raised when an error occurs on the connection to the instance of SQL Server.
公共类 ConnectionFailureException The ConnectionFailureException class is an exception that is raised when an unsuccessful attempt is made to establish a connection with the instance of SQL Server.
公共类 ConnectionInfoBase The ConnectionInfoBase object is a base class that is used in the construction of the SqlOlapConnectionInfoBase class and it represents information used to connect to an instance of SQL Server.
公共类 ConnectionManager The ConnectionManager class manages the connection to an instance of SQL Server.
公共类 ConnectionSettings The ConnectionSettings class represents the settings used by a connection to an instance of a server, such as SQL Server. The ServerConnection class inherits ConnectionSettings class.
公共类 DataTransferEventArgs The DataTransferEventArgs class represents the arguments used when a data transfer event is raised.
公共类 DataTransferProgressEventArgs The DataTransferProgressEventArgs class represents the arguments used when a data transfer progress event is raised.
公共类 DisconnectedConnectionException The DisconnectedConnectionException class is an exception that is raised when a connection is closed.
公共类 ExecutionFailureException The ExecutionFailureException class is an exception that is raised when an execution failure is encountered on the connection to the server.
公共类 InvalidArgumentException 在服务器的引用连接上将无效参数传递给方法时引发的异常。
公共类 InvalidPropertyValueException The exception that is raised when a property is set to a value that is not valid on the referenced connection to the server.
公共类 NotInTransactionException The exception that is raised when an error occurs within a transaction on the referenced connection to the server.
公共类 OlapConnectionInfo This class supports the SMO infrastructure and is not intended to be used directly from your code.
公共类 PropertyNotAvailableException The exception that is raised when an unavailable property is requested on the connection to the server.
公共类 PropertyNotSetException The exception that is raised when a process requests a property that has not been set on the connection to the server.
公共类 ServerComparer Represents the comparer class.
公共类 ServerConnection The ServerConnection object represents a connection to a server.
公共类 ServerMessageEventArgs The ServerMessageEventArgs class represents the arguments used when a server message event is raised.
公共类 ServerVersion ServerVersion 类表示服务器的版本信息。
公共类 SqlConnectionInfo The SqlConnectionInfo object represents information that is required to establish a connection to an instance of SQL Server.
公共类 SqlOlapConnectionInfoBase The SqlOlapConnectionInfoBase class represents information used to connect to the instance of SQL Server.
公共类 SqlServerManagementException The SqlServerManagementException class is an exception that is raised when a SQL Server management error is encountered on the connection to the server.
公共类 StatementEventArgs The StatementEventArgs class represents the arguments used when a statement event is raised.
公共类 TransferException The TransferException class is an exception that is raised when a SQL Server transfer error is encountered on the connection to the server.

接口

  接口 说明
公共接口 IAlterable Defines a method to alter an object on the referenced connection.
公共接口 ICreatable Defines a method to create an object on the referenced connection.
公共接口 IDataTransferProvider Defines methods and events for data transfers on the referenced connection.
公共接口 IDroppable Defines a method to Drop an object on the referenced connection.
公共接口 IMarkForDrop Defines a method that marks an object to be dropped.
公共接口 IRefreshable Defines a method to refresh an object from the server on the referenced connection.
公共接口 IRenamable Defines the Rename method on the referenced connection.
公共接口 IRestrictedAccess Represents an interface that implements single-user access to the server for the referenced connection.
公共接口 ISfcConnection Defines high-level properties and methods for server connections.
公共接口 ITransferMetadataProvider Defines methods that are required for transferring metadata on the referenced connection.

委托

  委托 说明
公共委托 DataTransferEventHandler DataTransferEventHandler 类表示处理由数据传输过程引发的事件的方法。
公共委托 DataTransferProgressEventHandler 表示处理由数据传输进度报告过程引发的事件的方法。
公共委托 ServerMessageEventHandler The ServerMessageEventHandler class represents the method that handles the event raised by a server message.
公共委托 StatementEventHandler The StatementEventHandler class represents the method that handles the event raised by a statement.

枚举

  枚举 说明
公共枚举 AutoDisconnectMode Contains values that are used to specify the automatic disconnection options for a connection to an instance of SQL Server.
受保护枚举 ConnectionManager. . :: . .ExecuteTSqlAction Execute a Transact-SQL action.
公共枚举 ConnectionType The ConnectionType enumeration contains values that are used to specify the type of server with which the connection is established.
公共枚举 DatabaseEngineType Database engine type of stand-alone instance of SQL Server or SQL Azure Database.
公共枚举 DataTransferEventType The DataTransferEventType enumeration contains values that are used to specify the type of data transfer event.
公共枚举 DataTransferProgressEventType The DataTransferProgressEventType enumeration contains values that are used to specify the type of data transfer progress event.
公共枚举 DeferredUseMode The DeferredUseMode enumeration contains values that specify how that deferred use can be instructed to handle Transact-SQL statements on the server connection. 
公共枚举 ExecutionTypes The ExecutionTypes enumeration contains values that are used to specify execution options for the Transact-SQL commands sent to the server using the referenced connection.
公共枚举 FixedServerRoles The FixedServerRoles enumeration contains values that are used to specify fixed server roles that can be assigned to logons.
公共枚举 NetworkProtocol Contains values that are used to specify network protocols used on the network where the referenced connection is established.
公共枚举 QueryParameterizationMode QueryParameterizationMode 枚举包含的值用于指定服务器连接处理带参数的查询的方式。
公共枚举 ServerCaseSensitivity Contains values that are used to specify whether the server is sensitive to the case (lower or upper) of text.
公共枚举 ServerType ServerType 枚举包含指定不同类型的 SQL Server 服务的值。
公共枚举 ServerUserProfiles ServerUserProfiles 枚举包含用来在服务器上指定用户配置文件的值。
公共枚举 SqlExecutionModes The SqlExecutionModes enumeration contains values that are used to specify whether the commands sent to the referenced connection to the server are executed immediately or saved in a buffer.