DataCommand.DeriveSchema Method
Derives the schema returned from a specified command, indicating the layout of items and blocks in a data reader.
Namespace: Microsoft.VisualStudio.Data
Assembly: Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)
Syntax
'Declaration
Public Overridable Function DeriveSchema ( _
command As String, _
commandType As Integer, _
parameters As DataParameter(), _
commandTimeout As Integer _
) As DataReader
public virtual DataReader DeriveSchema(
string command,
int commandType,
DataParameter[] parameters,
int commandTimeout
)
public:
virtual DataReader^ DeriveSchema(
String^ command,
int commandType,
array<DataParameter^>^ parameters,
int commandTimeout
)
abstract DeriveSchema :
command:string *
commandType:int *
parameters:DataParameter[] *
commandTimeout:int -> DataReader
override DeriveSchema :
command:string *
commandType:int *
parameters:DataParameter[] *
commandTimeout:int -> DataReader
public function DeriveSchema(
command : String,
commandType : int,
parameters : DataParameter[],
commandTimeout : int
) : DataReader
Parameters
command
Type: System.StringA command for which to derive the schema specific to a data source.
commandType
Type: System.Int32The command type for the indicated command, specifying how to interpret the contents of the command parameter.
parameters
Type: array<Microsoft.VisualStudio.Data.DataParameter[]An array of DataParameter objects for the specified command type. While this is an input parameter, the DDEX provider is still able to set properties on individual out and return value parameters. However, these will not be populated when deriving schema.
commandTimeout
Type: System.Int32The length of time, in seconds, to block the client before canceling the schema derivation and returning to the caller. A value of 0 indicates infinite timeout; a value of -1 indicates a provider default.
Return Value
Type: Microsoft.VisualStudio.Data.DataReader
Returns a DataReader object. This object provides a forward-only, read-only data stream that describes the layout of items and blocks, that is, the schema, for the reader object returned upon executing the specified command.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The command or asyncCommandEvents are null. |
ArgumentException | The commandType specifies an invalid type. |
ArgumentOutOfRangeException | The commandTimeout is less than -1. |
NotSupportedException | The provider does not support this method. |
Remarks
The schema of the data reader returned by this method must follow a specific format. For each result that would be returned when executing the command, there should be a result in the data reader. Each of these results should contain blocks that describe the items that would be returned when executing the command. The description should contain the following items:
Name (String): the name of the item.
Ordinal (Int32): the position of the item.
UserDataType (String): the user data type of the item (for example, "myType").
NativeDataType (String): the native data type of the item (for example, "nvarchar").
ProviderDataType (Int32): the provider data type of the item (for example, System.Data.DbType.StringFixedLength).
FrameworkDataType (Type): the framework data type of the item (for example, System.Int32).
Length (Int32): the maximum length of an item, if applicable.
Precision (Int32): the precision of an item, if applicable.
Scale (Int32): the scale of an item, if applicable.
Nullable (Boolean): the nullability of an item.
Those items that a provider does not support (for example, some forms of the data type) should be present but set to nulla null reference (Nothing in Visual Basic).
Note
Other exceptions that occur indicate that the parameter derivation failed for a provider-specified reason.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.