tursodatabase/turso · error · NotSupportedException
TursoCommand only supports CommandType.Text.
Error message
TursoCommand only supports CommandType.Text.
What it means
TursoCommand only executes SQL text. The CommandType getter always returns CommandType.Text, and the setter throws NotSupportedException for any other value (TursoCommand.cs:52-60) because the underlying Turso engine has no stored procedures or TableDirect support.
Source
Thrown at bindings/dotnet/src/Turso.Data/TursoCommand.cs:55
[AllowNull]
public override string CommandText { get; set; } = "";
public override int CommandTimeout
{
get => _commandTimeout;
set
{
ArgumentOutOfRangeException.ThrowIfNegative(value);
_commandTimeout = value;
}
}
public override CommandType CommandType
{
get => CommandType.Text;
set
{
if (value != CommandType.Text)
throw new NotSupportedException("TursoCommand only supports CommandType.Text.");
}
}
public override bool DesignTimeVisible { get; set; }
public override UpdateRowSource UpdatedRowSource { get; set; }
protected override DbConnection? DbConnection
{
get => _connection;
set
{
if (value is null)
{
_connection = null;
return;
}
_connection = value as TursoConnectionView on GitHub (pinned to c1e5928725)
Solutions
- Delete the CommandType assignment; Text is the default behavior.
- Inline the stored procedure's SQL into CommandText, or create a view/table function equivalent.
- When calling Dapper, use CommandText with inline SQL and the default CommandDefinition (Text).
Example fix
// before cmd.CommandText = "GetUserById"; cmd.CommandType = CommandType.StoredProcedure; // throws NotSupportedException // after cmd.CommandText = "SELECT * FROM users WHERE id = @id"; // Text is the default
Defensive patterns
Strategy: validation
Validate before calling
if (cmd is TursoCommand && desiredType != CommandType.Text)
{
// TursoCommand only supports Text; inline the SQL instead.
throw new NotSupportedException($"Cannot set {desiredType} on a TursoCommand.");
} Try / catch
try
{
cmd.CommandType = CommandType.StoredProcedure;
}
catch (NotSupportedException)
{
// Fall back to inline SQL text for Turso.
} Prevention
- Leave CommandType at its default (Text) for Turso commands.
- Avoid Dapper/ADO.NET stored-procedure invocation paths against Turso.
- Centralize provider capability checks when migrating code between providers.
When it happens
Trigger: Assigning command.CommandType = CommandType.StoredProcedure or CommandType.TableDirect on a TursoCommand, e.g. var cmd = conn.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure;
Common situations: Migrating Microsoft.Data.SqlClient code that invokes stored procedures; Dapper or hand-rolled helpers invoked with commandType: CommandType.StoredProcedure; ORM adapters that set CommandType generically on every command.
Related errors
- TursoBatchCommand only supports CommandType.Text.
- Turso batch execution is currently supported only for remote
- Batch command must be a TursoBatchCommand.
- Connection must be a TursoConnection.
- Transaction must be a TursoTransaction.
AI-assisted analysis of tursodatabase/turso@c1e5928725 (2026-08-20).
Data as JSON: /api/errors/9794bb3caa2b0133.
Report an issue: GitHub.