DataCommand Class
Provides the ability to build and execute data commands of various types against data sources, and to retrieve read-only results or a command status code.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Data.Framework.DataSiteableObject<IVsDataConnection>
Microsoft.VisualStudio.Data.Framework.DataCommand
Namespace: Microsoft.VisualStudio.Data.Framework
Assembly: Microsoft.VisualStudio.Data.Framework (in Microsoft.VisualStudio.Data.Framework.dll)
Syntax
'Declaration
Public MustInherit Class DataCommand _
Inherits DataSiteableObject(Of IVsDataConnection) _
Implements IVsDataCommand
public abstract class DataCommand : DataSiteableObject<IVsDataConnection>,
IVsDataCommand
public ref class DataCommand abstract : public DataSiteableObject<IVsDataConnection^>,
IVsDataCommand
[<AbstractClass>]
type DataCommand =
class
inherit DataSiteableObject<IVsDataConnection>
interface IVsDataCommand
end
public abstract class DataCommand extends DataSiteableObject<IVsDataConnection> implements IVsDataCommand
The DataCommand type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DataCommand() | Initializes a new instance of the DataCommand class. | |
DataCommand(IVsDataConnection) | Initializes a new instance of the DataCommand class together with a data connection object. |
Top
Properties
Name | Description | |
---|---|---|
Site | Gets or sets the object site. (Inherited from DataSiteableObject<T>.) |
Top
Methods
Name | Description | |
---|---|---|
CreateParameter | Creates a parameter object that can be passed into the DeriveSchema, DeriveSchema, Execute, or ExecuteWithoutResults methods on a DataCommand instance. | |
DeriveParameters(String) | Derives the parameters that can be specified for a given command. | |
DeriveParameters(String, DataCommandType) | Derives the parameters that can be specified for a given command. | |
DeriveParameters(String, DataCommandType, Int32) | Derives the parameters that can be specified for a given command. | |
DeriveSchema(String) | Derives the schema returned from a specified command. The schema indicates the layout of items and blocks in a data reader. | |
DeriveSchema(String, DataCommandType) | Derives the schema returned from a specified command. The schema indicates the layout of items and blocks in a data reader. | |
DeriveSchema(String, DataCommandType, array<IVsDataParameter[]) | Derives the schema returned from a specified command. The schema indicates the layout of items and blocks in a data reader. | |
DeriveSchema(String, DataCommandType, array<IVsDataParameter[], Int32) | Derives the schema returned from a specified command. The schema indicates the layout of items and blocks in a data reader. | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Execute(String) | Executes a specified command and returns read-only results. | |
Execute(String, DataCommandType) | Executes a specified command and returns read-only results. | |
Execute(String, DataCommandType, array<IVsDataParameter[]) | Executes a specified command, optionally with parameters, and returns read-only results. | |
Execute(String, DataCommandType, array<IVsDataParameter[], Int32) | Executes a specified command, optionally with parameters, and returns read-only results. | |
ExecuteWithoutResults(String) | Executes a command but does not request results, instead returning an integer indicating the outcome of the call. | |
ExecuteWithoutResults(String, DataCommandType) | Executes a command but does not request results, instead returning an integer indicating the outcome of the call. | |
ExecuteWithoutResults(String, DataCommandType, array<IVsDataParameter[]) | Executes a command, optionally with parameters, but does not request results, instead returning an integer indicating the outcome of the call. | |
ExecuteWithoutResults(String, DataCommandType, array<IVsDataParameter[], Int32) | Executes a command, optionally with parameters, but does not request results, instead returning an integer indicating the outcome of the call. | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnSiteChanged | Raises the SiteChanged event. (Inherited from DataSiteableObject<T>.) | |
Prepare(String) | Prepares the specified command on the data source to be executed; the command can then be executed multiple times, with varying parameters. | |
Prepare(String, DataCommandType) | Prepares the specified command on the data source to be executed; the command can then be executed multiple times, with varying parameters. | |
Prepare(String, DataCommandType, array<IVsDataParameter[]) | Prepares the specified command on the data source to be executed; the command can then be executed multiple times, with varying parameters. | |
Prepare(String, DataCommandType, array<IVsDataParameter[], Int32) | Prepares the specified command on the data source to be executed; the command can then be executed multiple times, with varying parameters. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Events
Name | Description | |
---|---|---|
SiteChanged | Occurs when the Site property is changed. (Inherited from DataSiteableObject<T>.) |
Top
Remarks
Data Designer Extensibility (DDEX) providers can execute various types of commands against a data source. This may include, but is not limited to, SQL statements, procedures, and function calls. They may also expose the ability to prepare and derive parameters and schemas for commands.
The DataCommand class introduces command types. A command type indicates a programmatic interpretation of a given command string. For example, a command type Text might notify the DDEX provider that the command string is a SQL statement that should be executed directly. Alternatively, a TabularFunction command type might notify the DDEX provider that the command string is the name of a table-valued function that should be executed by using the appropriate method.
Underlying technologies such as Open Database Connectivity (ODBC), OLE DB, and ADO.NET attempt to enumerate a set of allowed command types, typically as plain text, in table form, or as stored procedures. The DataCommand class extends this concept by relaxing the requirement that such a command type originate in a fixed enumeration. This provides flexibility by enabling DDEX providers to add custom command types, along with descriptions of how and when the commands can be used.
Hinweis
To provide command execution capability asynchronously, use the DataAsyncCommand class. This class has a set of methods that are equivalent to those on the DataCommand class, but these methods operate asynchronously.
Notes to Inheritors
When you inherit from the DataCommand class, you must override each method from this class that is to be supported by its DDEX provider implementation. The base implementation of each method in this class throws a NotSupportedException.
Note that the ExecuteWithoutResults method has a base implementation that delegates to the Execute method.
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.