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.DataCommand
Namespace: Microsoft.VisualStudio.Data
Assembly: Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)
Syntax
'Declaration
<GuidAttribute("E19F79F4-3219-423d-97A4-5A2B8A8F45F3")> _
Public MustInherit Class DataCommand
[GuidAttribute("E19F79F4-3219-423d-97A4-5A2B8A8F45F3")]
public abstract class DataCommand
[GuidAttribute(L"E19F79F4-3219-423d-97A4-5A2B8A8F45F3")]
public ref class DataCommand abstract
[<AbstractClass>]
[<GuidAttribute("E19F79F4-3219-423d-97A4-5A2B8A8F45F3")>]
type DataCommand = class end
public abstract class DataCommand
The DataCommand type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DataCommand | Class constructor. Instantiates a new instance of the DataCommand class. |
Top
Methods
Name | Description | |
---|---|---|
CreateParameter | Creates a parameter object that can be passed into the DeriveSchema, Execute or ExecuteWithoutResultsmethods on a DataCommandclass instance. | |
DeriveParameters | Derives the parameters that can be specified for a given command. | |
DeriveSchema | Derives the schema returned from a specified command, indicating 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 | Executes a specified command, optionally with parameters, and returns read-only results. | |
ExecuteWithoutResults | 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.) | |
Prepare | Prepares the specified command on the data source to be executed; the command may then be executed multiple times, with varying parameters. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Remarks
DDEX Providers can execute various types of commands against the 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 the concept of a command type. A command type indicates a programmatic interpretation of a given command string. For example, a command type "Text" might tell the DDEX provider that the command string is a SQL statement that should be executed directly. On the other hand, a "TabularFunction" command type might tell the DDEX provider that the command string is the name of a table-valued function that should be executed using the appropriate method.
Underlying technologies like ODBC, OLE DB, and ADO.NET attempt to enumerate a set of allowable 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 enormous flexibility by allowing DDEX providers to add custom command types, including descriptions of how and when the commands can be used.
Note
To provide command execution capability, but asynchronously, use the DataAsyncCommandclass, which has a set of methods equivalent to those on the DataCommand class, but which operate asynchronously.
Classes derived from the DataCommand class should implement those methods that are supported by their DDEX provider implementation. The base implementation of each method simply throws a NotSupportedException.
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.