{"record":{"id":"9794bb3caa2b0133","repo":"tursodatabase/turso","slug":"tursocommand-only-supports-commandtype-text","errorCode":null,"errorMessage":"TursoCommand only supports CommandType.Text.","messagePattern":"TursoCommand only supports CommandType\\.Text\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoCommand.cs","lineNumber":55,"sourceCode":"    [AllowNull]\n    public override string CommandText { get; set; } = \"\";\n    public override int CommandTimeout\n    {\n        get => _commandTimeout;\n        set\n        {\n            ArgumentOutOfRangeException.ThrowIfNegative(value);\n            _commandTimeout = value;\n        }\n    }\n\n    public override CommandType CommandType\n    {\n        get => CommandType.Text;\n        set\n        {\n            if (value != CommandType.Text)\n                throw new NotSupportedException(\"TursoCommand only supports CommandType.Text.\");\n        }\n    }\n\n    public override bool DesignTimeVisible { get; set; }\n    public override UpdateRowSource UpdatedRowSource { get; set; }\n\n    protected override DbConnection? DbConnection\n    {\n        get => _connection;\n        set\n        {\n            if (value is null)\n            {\n                _connection = null;\n                return;\n            }\n\n            _connection = value as TursoConnection","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/tursodatabase/turso/blob/c1e59287258d99b309e362a63f48822256e2f65f/bindings/dotnet/src/Turso.Data/TursoCommand.cs#L37-L73","documentation":"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.","triggerScenarios":"Assigning command.CommandType = CommandType.StoredProcedure or CommandType.TableDirect on a TursoCommand, e.g. var cmd = conn.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure;","commonSituations":"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.","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)."],"exampleFix":"// before\ncmd.CommandText = \"GetUserById\";\ncmd.CommandType = CommandType.StoredProcedure; // throws NotSupportedException\n\n// after\ncmd.CommandText = \"SELECT * FROM users WHERE id = @id\"; // Text is the default","handlingStrategy":"validation","validationCode":"if (cmd is TursoCommand && desiredType != CommandType.Text)\n{\n    // TursoCommand only supports Text; inline the SQL instead.\n    throw new NotSupportedException($\"Cannot set {desiredType} on a TursoCommand.\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    cmd.CommandType = CommandType.StoredProcedure;\n}\ncatch (NotSupportedException)\n{\n    // Fall back to inline SQL text for Turso.\n}","preventionTips":["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."],"tags":["dotnet","ado-net","tursodb","commandtype","stored-procedure"],"backgroundTag":"unsupported-command-type","analyzedSha":"c1e59287258d99b309e362a63f48822256e2f65f","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}