QuillCode.Data.Sql.MySql 0.2.0

dotnet add package QuillCode.Data.Sql.MySql --version 0.2.0
                    
NuGet\Install-Package QuillCode.Data.Sql.MySql -Version 0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="QuillCode.Data.Sql.MySql" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="QuillCode.Data.Sql.MySql" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="QuillCode.Data.Sql.MySql" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add QuillCode.Data.Sql.MySql --version 0.2.0
                    
#r "nuget: QuillCode.Data.Sql.MySql, 0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package QuillCode.Data.Sql.MySql@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=QuillCode.Data.Sql.MySql&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=QuillCode.Data.Sql.MySql&version=0.2.0
                    
Install as a Cake Tool

Quill.Code

Shared building blocks for .NET code editors, independent of the UI framework (WPF, MAUI…): syntax highlighting, completion, diagnostics and editing algorithms.

Packages

Package Contents
Quill.Code Models, contracts, reading of .xshd definitions, splitting into colored spans, editing algorithms. No UI dependency.
Quill.Code.CSharp C# via Roslyn: completion, diagnostics, hover, signature help, compilation and loading.
Quill.Code.CSharp.Linq LINQ / Entity Framework Core (net10.0), engine-agnostic: DbContext generated from a database structure (Quill.Data.Sql), C# completion, diagnostics and hover in that context (LinqLanguageService), execution (LinqQueryExecutor, same contract as SqlServerQueryExecutor); the engine is an ILinqDatabaseProvider.
Quill.Code.CSharp.Linq.SqlServer SqlServerLinqProvider: LINQ on SQL Server (SQL Server types, EF Core SqlServer, Microsoft.Data.SqlClient).
Quill.Code.CSharp.Linq.MySql MySqlLinqProvider: LINQ on MySQL / MariaDB (Microting.EntityFrameworkCore.MySql, EF Core 10 fork of Pomelo, MySqlConnector).
Quill.Code.CSharp.Linq.PostgreSql PostgreSqlLinqProvider: LINQ on PostgreSQL (Npgsql.EntityFrameworkCore.PostgreSQL).
Quill.Code.CSharp.Linq.Oracle OracleLinqProvider: LINQ on Oracle (Oracle.EntityFrameworkCore, 19c-compatible SQL).
Quill.Code.CSharp.Linq.Sqlite SqliteLinqProvider: LINQ on SQLite (Microsoft.EntityFrameworkCore.Sqlite).
Quill.Code.Sql Foundation of SQL execution: ISqlQueryExecutor contract and ADO.NET base (DbQueryExecutor, DbResultSetReader). No dependency.
Quill.Code.Sql.SqlServer T-SQL: lexer, input context analysis (what the grammar expects at the caret, tables and aliases of the batch, database of the USE), syntax diagnostics through ScriptDom, completion and hover on the catalog provided by the host (ISqlCatalog); execution on SQL Server (SqlServerQueryExecutor).
Quill.Code.Sql.MySql / .PostgreSql / .Oracle / .Sqlite SQL execution on each engine (MySqlQueryExecutor, PostgreSqlQueryExecutor, OracleQueryExecutor — script split as in SQL*Plus —, SqliteQueryExecutor), on DbQueryExecutor.
Quill.Data.Sql Structure of a database (databases, schemas, tables, views, procedures, columns) and catalog reading contract (ISqlSchemaReader). No dependency.
Quill.Data.Sql.SqlServer Reads the SQL Server catalog (sys.*) via Microsoft.Data.SqlClient.
Quill.Data.Sql.MySql / .PostgreSql / .Oracle / .Sqlite Catalog reading: information_schema (MySqlConnector), pg_catalog (Npgsql), ALL_* views (ODP.NET Core), sqlite_master and pragmas (Microsoft.Data.Sqlite).

Display is up to the application: each app maps colored spans, suggestions and diagnostics to its own controls.

Installation

Packages are published on nuget.org:

dotnet add package QuillCode.CSharp

Since the Quill. prefix is reserved on nuget.org, each Quill.Code.X project is published under the ID QuillCode.X and Quill.Data.Sql.X under QuillCode.Data.Sql.X; assemblies and namespaces keep their names.

Demo

src/Quill.Code.Demo is a WPF (Windows) application that wires a plain RichTextBox to Quill: highlighting, completion (while typing, after a dot, Ctrl+Space), hover, diagnostics and execution (F5).

dotnet run --project src/Quill.Code.Demo
  • SQL · SQLite and LINQ · SQLite: a fake "shop" database (customers, products, orders), a SQLite file recreated at each startup in the temporary folder; queries really run.
  • SQL Server, MySQL, PostgreSQL, Oracle: the same shop as a fictitious catalog (in-memory SqlCatalog), without connection or execution, to see each dialect at work ([name] / `name` / "name", @param / :param, TOP / LIMIT / FETCH FIRST).

It is outside Quill.Code.slnx (the CI builds on Linux): open src/Quill.Code.Demo.slnx.

Usage

One service per context, with its own Roslyn project, created on first request (off the UI thread):

var language = new CSharpLanguageService(() => new CSharpLanguageOptions
{
    Name = "Script",
    References = CSharpReferences.FromTrustedPlatformAssemblies(),
    CompilationOptions = new(OutputKind.ConsoleApplication),
    AdditionalDocuments = new Dictionary<string, string> { ["GlobalUsings.cs"] = "global using System;" },
    SourceTransform = code => code,   // optional: analyzed source, same length as the text
    TextReferences = code => [],      // optional: references declared by the text
    IncludeSemanticDiagnostics = true, // false: syntax errors only
});

var completions = await language.GetCompletionsAsync(code, caret);
var change = await language.GetChangeAsync(code, completions.Items[0]);
var diagnostics = await language.GetDiagnosticsAsync(code);

CSharpLanguageService implements ICodeLanguageService: an editor control binds to it without depending on Roslyn. Without options, the service analyzes a library that references the framework.

Compiling the same project as the editor, loaded into a collectible context (calling the code is up to the application):

using var compiled = await language.CompileAsync(code, new CSharpCompileOptions
{
    AssemblyFiles = packageAssemblies,     // loadable assemblies, read into memory
});

if (!compiled.Success)
    foreach (var error in compiled.Errors)
        Console.WriteLine(error.Describe(code)); // "Line 2, column 6: CS0103 …"
else
    Run(compiled.Assembly!);

A script (entry point or top-level statements) compiled and run in one call, with no return value: output goes through Log, the assembly is unloaded at the end.

try
{
    await language.RunAsync(code, new CSharpCompileOptions { Log = e => Console.WriteLine($"{e.Timestamp:HH:mm:ss} {e.Level} : {e.Text}") }, token);
}
catch (CSharpCompilationException ex)
{
    foreach (var error in ex.Errors)
        Console.WriteLine(error.Describe(code));
}

Positions received and returned are always those of the editor text.

Sources added on the fly (e.g. a helper class): visible to completion and analysis, compiled with the text.

language.SetSource("FileHelper.cs", helperCode);                       // name → code
var key = await language.SetSourceFileAsync(@"C:\Helpers\FileHelper.cs"); // read again on each call
language.RemoveSource(key);
language.SourcesChanged += (_, _) => RefreshDiagnostics();

An error in a source is returned at position 0 with the file: "FileHelper.cs (12, 5): …".

T-SQL

Quill connects to no database: the host provides an ISqlCatalog (databases, then the complete schema of a database, columns included), or an in-memory SqlCatalog.

var language = new SqlLanguageService(new SqlLanguageOptions
{
    Catalog = new SqlCatalog([new SqlDatabaseSchema("Shop", objects)]), // or the host's implementation
    Database = "Shop",                                                   // null: default database of the catalog
    Variables = [new SqlVariable("@MaxRows", "int", "Parameter")],       // known without DECLARE
});

var completions = await language.GetCompletionsAsync("SELECT u.| FROM dbo.Users u", caret); // columns of Users

Without a catalog, completion suggests keywords, document words and variables. An unavailable catalog returns an empty list (or null); an exception is treated as a missing schema.

Development

dotnet build src/Quill.Code.slnx
dotnet test src/Quill.Code.slnx

Publishing a version on nuget.org: git tag v0.1.0 && git push origin v0.1.0 (pre-release: v0.2.0-beta.1), then bump VersionPrefix in src/Directory.Build.props.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 103 11/14/2026
0.1.1 98 11/8/2026
0.1.0 130 11/6/2026