Shiny DocumentDb v3: One API, Four Databases
Shiny.SqliteDocumentDb has been rewritten as Shiny.DocumentDb — a multi-provider document store that keeps the same developer-friendly API while supporting four database backends.
What’s new in v3
Section titled “What’s new in v3”- SQL Server support via
Shiny.DocumentDb.SqlServer - MySQL support via
Shiny.DocumentDb.MySql - PostgreSQL support via
Shiny.DocumentDb.PostgreSql - SQLite continues to work via
Shiny.DocumentDb.Sqlite - Same API —
IDocumentStore, fluent queries, projections, aggregates, transactions, AOT support — all provider-agnostic - DI extensions bundled into each provider package — no separate DI package needed
Provider setup
Section titled “Provider setup”Each provider follows the same pattern — install the provider package and register with DI:
SQLite
Section titled “SQLite”dotnet add package Shiny.DocumentDb.Sqliteusing Shiny.DocumentDb.Sqlite;services.AddSqliteDocumentStore("Data Source=mydata.db");SQL Server
Section titled “SQL Server”dotnet add package Shiny.DocumentDb.SqlServerusing Shiny.DocumentDb.SqlServer;services.AddSqlServerDocumentStore("Server=localhost;Database=mydb;Trusted_Connection=true;");dotnet add package Shiny.DocumentDb.MySqlusing Shiny.DocumentDb.MySql;services.AddMySqlDocumentStore("Server=localhost;Database=mydb;User=root;Password=pass;");PostgreSQL
Section titled “PostgreSQL”dotnet add package Shiny.DocumentDb.PostgreSqlusing Shiny.DocumentDb.PostgreSql;services.AddPostgreSqlDocumentStore("Host=localhost;Database=mydb;Username=postgres;Password=pass;");Migration from v2
Section titled “Migration from v2”Package changes
Section titled “Package changes”| v2 Package | v3 Package |
|---|---|
Shiny.SqliteDocumentDb | Shiny.DocumentDb.Sqlite |
Shiny.SqliteDocumentDb.Extensions.DependencyInjection | (included in provider package) |
Code changes
Section titled “Code changes”1. Update using statements:
// Beforeusing Shiny.SqliteDocumentDb;using Shiny.SqliteDocumentDb.Extensions.DependencyInjection;
// Afterusing Shiny.DocumentDb;using Shiny.DocumentDb.Sqlite;2. Update DI registration:
// Beforeservices.AddSqliteDocumentStore("Data Source=mydata.db");services.AddSqliteDocumentStore(opts => opts.ConnectionString = "Data Source=mydata.db");
// Afterservices.AddSqliteDocumentStore("Data Source=mydata.db"); // simple overload unchangedservices.AddSqliteDocumentStore(opts =>{ opts.DatabaseProvider = new SqliteDatabaseProvider("Data Source=mydata.db");});3. Update direct instantiation:
// Beforevar store = new SqliteDocumentStore(new DocumentStoreOptions{ ConnectionString = "Data Source=mydata.db"});
// Aftervar store = new SqliteDocumentStore(new DocumentStoreOptions{ DatabaseProvider = new SqliteDatabaseProvider("Data Source=mydata.db")});
// Or use the convenience constructor (unchanged)var store = new SqliteDocumentStore("Data Source=mydata.db");4. IDocumentStore usage is unchanged — all query, CRUD, projection, aggregate, and transaction code works exactly the same.
Documentation
Section titled “Documentation”Full documentation is available at /data/documentdb/.