|
5 | 5 | [](https://www.nuget.org/packages/Shiny.DocumentDb.MySql/) |
6 | 6 | [](https://www.nuget.org/packages/Shiny.DocumentDb.SqlServer/) |
7 | 7 | [](https://www.nuget.org/packages/Shiny.DocumentDb.PostgreSql/) |
| 8 | +[](https://www.nuget.org/packages/Shiny.DocumentDb.Extensions.DependencyInjection/) |
8 | 9 |
|
9 | 10 | A lightweight, multi-provider document store for .NET that turns relational databases into a schema-free JSON document database with LINQ querying and full AOT/trimming support. Supports **SQLite**, **MySQL**, **SQL Server**, and **PostgreSQL**. |
10 | 11 |
|
@@ -250,7 +251,12 @@ dotnet add package Shiny.DocumentDb.SqlServer |
250 | 251 | dotnet add package Shiny.DocumentDb.PostgreSql |
251 | 252 | ``` |
252 | 253 |
|
253 | | -Each provider package includes dependency injection extensions — no separate DI package needed. |
| 254 | +Each provider package includes dependency injection extensions. A standalone DI package is also available for provider-agnostic registration: |
| 255 | + |
| 256 | +```bash |
| 257 | +# Generic DI extensions (bring your own provider) |
| 258 | +dotnet add package Shiny.DocumentDb.Extensions.DependencyInjection |
| 259 | +``` |
254 | 260 |
|
255 | 261 | ## Setup |
256 | 262 |
|
@@ -332,6 +338,22 @@ services.AddSqliteDocumentStore(opts => |
332 | 338 | }); |
333 | 339 | ``` |
334 | 340 |
|
| 341 | +#### Generic (provider-agnostic) registration |
| 342 | + |
| 343 | +If you want to register the document store without depending on a specific provider package, use the standalone DI extensions package: |
| 344 | + |
| 345 | +```csharp |
| 346 | +using Shiny.DocumentDb; |
| 347 | + |
| 348 | +services.AddDocumentStore(opts => |
| 349 | +{ |
| 350 | + opts.DatabaseProvider = new SqliteDatabaseProvider("Data Source=mydata.db"); |
| 351 | + opts.TypeNameResolution = TypeNameResolution.FullName; |
| 352 | +}); |
| 353 | +``` |
| 354 | + |
| 355 | +This is useful when the provider is determined at runtime or when building libraries that accept any `IDatabaseProvider`. |
| 356 | + |
335 | 357 | All DI methods register `IDocumentStore` as a singleton. |
336 | 358 |
|
337 | 359 | ## Table-Per-Type Mapping |
|
0 commit comments