From 5efd7c8d7f22f4ccfc9cf1b1d4aa98ef7e305a7c Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sun, 28 Apr 2024 10:20:17 -0600 Subject: [PATCH] chore: update docs (#818) --- CHANGELOG.md | 17 ++++++++----- README.md | 48 +++++++++++++++++++++-------------- docs/ConfigurationAndUsage.md | 12 ++++++--- docs/History.md | 23 +++++++++-------- docs/Index.md | 2 +- docs/WhatsNew.md | 19 +++++++++----- 6 files changed, 73 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ff04c69..cc947751 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,13 +3,16 @@ ### ⚠ BREAKING CHANGES -* Many namespaces have been updated for consistency. Most code will only need to reference the `Finbuckle.MultiTenant` namespace. -* Connection string is removed because in many cases it is not needed. Closes #624 -* all unique indexes and the UserLogin primary key in the standard Identity models are adjusted to include the tenant id -* (I)MultiTenantContext and (I)TenantInfo are no longer available via DI. Use IMultiTenantContextAccessor instead. Also IMultiTenantContext nullability reworked and should never be null. +* (I)MultiTenantContext and (I)TenantInfo are no longer available via dependency injection. Use + IMultiTenantContextAccessor instead. MultiTenantDbContext and MultiTenantIdentityDbContext will require a new + constructor that injects IMultiTenantContextAccessor or IMultiTenantContext. +* Many namespaces have been updated for consistency. Most code will only need to use the Finbuckle.MultiTenant or + Finbuckle.MultiTenant.Abstractions namespace. +* Connection string is removed from ITenantInfo and the default TenantInfo implementation. +* Added support for OptionsBuilder API and more efficient per-tenant options overall. * WithPerTenantOptions replaced by ConfigurePerTenant service collection extensions methods. - -Added support for `OptionsBuilder` API and more efficient per-tenant options overall. +* Unique indexes and the UserLogin primary key in the standard Identity models adjusted to include tenant id. +* IMultiTenantContext nullability reworked and should never be null. ### Features @@ -321,7 +324,7 @@ Added support for `OptionsBuilder` API and more efficient per-tenant options ove - Added support for ASP.NET Core 3.1. - Major refactor of how Entity Framework multitenant data isolation works. No longer need to derive from `MultiTenantDbContext` greatly improving flexibility. `IdentityMultiTenantDbContext` reworked under this new model and no longer requires or recommends use of multitenant support classes, e.g. `MultiTenantIdentityUser`. Attempted to minimize impact, but if using `IdentityMultiTenantDbContext` **this may be a breaking change!** Thanks **@GordonBlahut**! - Simplified `EFCoreStore` to use `TenantInfo` directly. **This is a breaking change!** -- Fixed a bug with user id not being set correctly in legacy 'IdentityMultiTenantDbContext'. +- Fixed a bug with user id not being set correctly in legacy `IdentityMultiTenantDbContext`. - Added `ConfigurationStore` to load tenant information from app configuration. The store is read-only in code, but changes in configuration (e.g. appsettings.json) are picked up at runtime. Updated most sample projects to use this store. - Deprecated `InMemoryStore` functionality that reads from configuration. - Added `HttpRemoteStore` which will make an http request to get a `TenantInfo` object. It can be extended with `DelegatingHandler`s (i.e. to add authentication headers). Added sample projects for this store. Thanks to **@colindekker**! diff --git a/README.md b/README.md index 1a8c4d4e..d3f92b98 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Current publish feed release: Table of Contents -1. [What's New in Finbuckle.MultiTenant 7.0.0](#whats-new) +1. [What's New in v7.0.0](#whats-new) 2. [Quick Start](#quick-start) 3. [Documentation](#documentation) 4. [Sample Projects](#sample-projects) @@ -23,37 +23,47 @@ Table of Contents 10. [Building from Source](#building-from-source) 11. [Running Unit Tests](#running-unit-tests) -## What's New in Finbuckle.MultiTenant 7.0.0 +## What's New in v7.0.0 - +> This section only lists release update details specific to v7.0.0. See +> the [changelog file](CHANGELOG.md) for all release update details. + ### ⚠ BREAKING CHANGES -* Many namespaces have been updated for consistency. Most code will only need to reference the namespace. -* Connection string is removed because in many cases it is not needed. Closes #624 -* all unique indexes and the UserLogin primary key in the standard Identity models are adjusted to include the tenant id -* (I)MultiTenantContext and (I)TenantInfo are no longer available via DI. Use IMultiTenantContextAccessor instead. Also IMultiTenantContext nullability reworked and should never be null. +* (I)MultiTenantContext and (I)TenantInfo are no longer available via dependency injection. Use + IMultiTenantContextAccessor instead. MultiTenantDbContext and MultiTenantIdentityDbContext will require a new + constructor that injects IMultiTenantContextAccessor or IMultiTenantContext. +* Many namespaces have been updated for consistency. Most code will only need to use the Finbuckle.MultiTenant or + Finbuckle.MultiTenant.Abstractions namespace. +* Connection string is removed from ITenantInfo and the default TenantInfo implementation. +* Added support for OptionsBuilder API and more efficient per-tenant options overall. * WithPerTenantOptions replaced by ConfigurePerTenant service collection extensions methods. - -Added support for API and more efficient per-tenant options overall. +* Unique indexes and the UserLogin primary key in the standard Identity models adjusted to include tenant id. +* IMultiTenantContext nullability reworked and should never be null. ### Features -* better options support ([#681](https://github.com/Finbuckle/Finbuckle.MultiTenant/issues/681)) ([1859017](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/185901786f2225eb38b3609770c60b98fdcbc122)) -* change default MultiTenantIdentityDbContext default index and key behavior ([81f5612](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/81f5612008c3335192d9b26beb22be9a28beca8b)) -* MultiTenantDbContext and MultiTenantIdentityDbContext support for IMultiTenantContextAccessor DI ([9015085](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/901508563af4fa872a0dc3930ff3b8315777b912)) -* namespace cleaned up ([b354838](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/b354838a90741626c47ea4f109c49f7fe2ca5b3d)) -* refactor DI and improve nullability ([eca24bf](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/eca24bfa0c314f95794b235141cff42059cf3fcf)) -* remove ConnectionString from ITenantInfo and TenantInfo ([f4e20db](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/f4e20db35fe9e31e1cfb37a667b1ba4b64ce6f3f)) - +* better options + support ([#681](https://github.com/Finbuckle/Finbuckle.MultiTenant/issues/681)) ([1859017](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/185901786f2225eb38b3609770c60b98fdcbc122)) +* change default MultiTenantIdentityDbContext default index and key + behavior ([81f5612](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/81f5612008c3335192d9b26beb22be9a28beca8b)) +* MultiTenantDbContext and MultiTenantIdentityDbContext support for IMultiTenantContextAccessor + DI ([9015085](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/901508563af4fa872a0dc3930ff3b8315777b912)) +* namespace cleaned + up ([b354838](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/b354838a90741626c47ea4f109c49f7fe2ca5b3d)) +* refactor DI and improve + nullability ([eca24bf](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/eca24bfa0c314f95794b235141cff42059cf3fcf)) +* remove ConnectionString from ITenantInfo and + TenantInfo ([f4e20db](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/f4e20db35fe9e31e1cfb37a667b1ba4b64ce6f3f)) ### Bug Fixes -* AdjustKey correctly adding TenantId to primary and foreign keys ([613b4a8](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/613b4a855e919e02910c42f9f534cddba40339c9)) - +* AdjustKey correctly adding TenantId to primary and foreign + keys ([613b4a8](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/613b4a855e919e02910c42f9f534cddba40339c9)) -See the [changelog file](CHANGELOG.md) for a full history of changes. + ## Quick Start diff --git a/docs/ConfigurationAndUsage.md b/docs/ConfigurationAndUsage.md index b5f0a9ca..47e1eb29 100644 --- a/docs/ConfigurationAndUsage.md +++ b/docs/ConfigurationAndUsage.md @@ -88,12 +88,16 @@ There are several ways an app can see the current tenant: ### Dependency Injection -* `IMultiTenantContextAccessor` and `IMultiContextContextAccessor` are available via dependency injection and behave - similar to `IHttpContextAccessor`. Internally an `AsyncLocal` is used to track state and in parent async contexts - any changes in tenant will not be reflected. For example, the accessor will not reflect a tenant in the post-endpoint - processing in ASP.NET Core middleware registered prior to `UseMultiTenant`. Use the `HttpContext` +* `IMultiTenantContextAccessor` and `IMultiTenantContextAccessor` are available via dependency injection + and behave similar to `IHttpContextAccessor`. Internally an `AsyncLocal` is used to track state and in parent async + contexts any changes in tenant will not be reflected. For example, the accessor will not reflect a tenant in the + post-endpoint processing in ASP.NET Core middleware registered prior to `UseMultiTenant`. Use the `HttpContext` extension `GetMultiTenantContext` to avoid this caveat. +* `IMultiTenantContextSetter` is available via dependency injection and can be used to set the current tenant. This is + useful in advanced scenarios and should be used with caution. Prefer using the `HttpContext` extension + method `TrySetTenantInfo` in use cases where `HttpContext` is available. + > Prior versions of Finbuckle.MultiTenant also exposed `IMultiTenantContext`, `ITenantInfo`, and their implementations > via dependency injection. This was removed as these are not actual services, similar to > how [HttpContext is not a service](https://github.com/dotnet/aspnetcore/issues/47996#issuecomment-1529364233) and not diff --git a/docs/History.md b/docs/History.md index 559d9f33..ba4dfff4 100644 --- a/docs/History.md +++ b/docs/History.md @@ -6,13 +6,16 @@ ### ⚠ BREAKING CHANGES -* Many namespaces have been updated for consistency. Most code will only need to reference the `Finbuckle.MultiTenant` namespace. -* Connection string is removed because in many cases it is not needed. Closes #624 -* all unique indexes and the UserLogin primary key in the standard Identity models are adjusted to include the tenant id -* (I)MultiTenantContext and (I)TenantInfo are no longer available via DI. Use IMultiTenantContextAccessor instead. Also IMultiTenantContext nullability reworked and should never be null. +* (I)MultiTenantContext and (I)TenantInfo are no longer available via dependency injection. Use + IMultiTenantContextAccessor instead. MultiTenantDbContext and MultiTenantIdentityDbContext will require a new + constructor that injects IMultiTenantContextAccessor or IMultiTenantContext. +* Many namespaces have been updated for consistency. Most code will only need to use the Finbuckle.MultiTenant or + Finbuckle.MultiTenant.Abstractions namespace. +* Connection string is removed from ITenantInfo and the default TenantInfo implementation. +* Added support for OptionsBuilder API and more efficient per-tenant options overall. * WithPerTenantOptions replaced by ConfigurePerTenant service collection extensions methods. - -Added support for `OptionsBuilder` API and more efficient per-tenant options overall. +* Unique indexes and the UserLogin primary key in the standard Identity models adjusted to include tenant id. +* IMultiTenantContext nullability reworked and should never be null. ### Features @@ -26,7 +29,7 @@ Added support for `OptionsBuilder` API and more efficient per-tenant options ove ### Bug Fixes -* AdjustKey correctly adding TenantId to primary and foreign keys ([613b4a8](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/613b4a855e919e02910c42f9f534cddba40339c9)) +* adjustKey correctly adding TenantId to primary and foreign keys ([613b4a8](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/613b4a855e919e02910c42f9f534cddba40339c9)) ## [6.13.1](https://github.com/Finbuckle/Finbuckle.MultiTenant/compare/v6.13.0...v6.13.1) (2024-01-24) @@ -81,7 +84,7 @@ Added support for `OptionsBuilder` API and more efficient per-tenant options ove ### Features -* add nongeneric IMultiTenantContext for flexibility ([b3a198f](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/b3a198f46aba9370f3671b62c35ae06b829a7d73)) +* add non-generic IMultiTenantContext for flexibility ([b3a198f](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/b3a198f46aba9370f3671b62c35ae06b829a7d73)) ### Bug Fixes @@ -169,7 +172,7 @@ Added support for `OptionsBuilder` API and more efficient per-tenant options ove ### Bug Fixes -* change delegate strategy func return type as nullabe and adds unit test ([#525](https://github.com/Finbuckle/Finbuckle.MultiTenant/issues/525)) ([80c7104](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/80c71041ad164da9ae8fb93a3ea0c68998b4e247)) +* change delegate strategy func return type as nullable and adds unit test ([#525](https://github.com/Finbuckle/Finbuckle.MultiTenant/issues/525)) ([80c7104](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/80c71041ad164da9ae8fb93a3ea0c68998b4e247)) * remove tenant id value generator ([#524](https://github.com/Finbuckle/Finbuckle.MultiTenant/issues/524)) ([0d3dcd8](https://github.com/Finbuckle/Finbuckle.MultiTenant/commit/0d3dcd891d23124c1589b736a0b2274d4fda060f)) ## [6.6.0](https://github.com/Finbuckle/Finbuckle.MultiTenant/compare/v6.5.1...v6.6.0) (2022-02-13) @@ -324,7 +327,7 @@ Added support for `OptionsBuilder` API and more efficient per-tenant options ove - Added support for ASP.NET Core 3.1. - Major refactor of how Entity Framework multitenant data isolation works. No longer need to derive from `MultiTenantDbContext` greatly improving flexibility. `IdentityMultiTenantDbContext` reworked under this new model and no longer requires or recommends use of multitenant support classes, e.g. `MultiTenantIdentityUser`. Attempted to minimize impact, but if using `IdentityMultiTenantDbContext` **this may be a breaking change!** Thanks ****! - Simplified `EFCoreStore` to use `TenantInfo` directly. **This is a breaking change!** -- Fixed a bug with user id not being set correctly in legacy 'IdentityMultiTenantDbContext'. +- Fixed a bug with user id not being set correctly in legacy `IdentityMultiTenantDbContext`. - Added `ConfigurationStore` to load tenant information from app configuration. The store is read-only in code, but changes in configuration (e.g. appsettings.json) are picked up at runtime. Updated most sample projects to use this store. - Deprecated `InMemoryStore` functionality that reads from configuration. - Added `HttpRemoteStore` which will make an http request to get a `TenantInfo` object. It can be extended with `DelegatingHandler`s (i.e. to add authentication headers). Added sample projects for this store. Thanks to ****! diff --git a/docs/Index.md b/docs/Index.md index d7f3368e..0c54be0a 100644 --- a/docs/Index.md +++ b/docs/Index.md @@ -1,6 +1,6 @@ [Introduction](Introduction) -[What's New in Finbuckle.MultiTenant 7.0.0](WhatsNew) +[What's New in v7.0.0](WhatsNew) [Version History](History) diff --git a/docs/WhatsNew.md b/docs/WhatsNew.md index 60c15a63..79c18230 100644 --- a/docs/WhatsNew.md +++ b/docs/WhatsNew.md @@ -1,4 +1,6 @@ -# What's New in Finbuckle.MultiTenant 7.0.0 +# What's New in v7.0.0 + +> This page only lists release update details specific to v7.0.0. [Release update details for all releases are shown in the history page.](History) ## [7.0.0](https://github.com/Finbuckle/Finbuckle.MultiTenant/compare/v6.13.1...v7.0.0) (2024-04-21) @@ -6,13 +8,16 @@ ### ⚠ BREAKING CHANGES -* Many namespaces have been updated for consistency. Most code will only need to reference the namespace. -* Connection string is removed because in many cases it is not needed. Closes #624 -* all unique indexes and the UserLogin primary key in the standard Identity models are adjusted to include the tenant id -* (I)MultiTenantContext and (I)TenantInfo are no longer available via DI. Use IMultiTenantContextAccessor instead. Also IMultiTenantContext nullability reworked and should never be null. +* (I)MultiTenantContext and (I)TenantInfo are no longer available via dependency injection. Use + IMultiTenantContextAccessor instead. MultiTenantDbContext and MultiTenantIdentityDbContext will require a new + constructor that injects IMultiTenantContextAccessor or IMultiTenantContext. +* Many namespaces have been updated for consistency. Most code will only need to use the Finbuckle.MultiTenant or + Finbuckle.MultiTenant.Abstractions namespace. +* Connection string is removed from ITenantInfo and the default TenantInfo implementation. +* Added support for OptionsBuilder API and more efficient per-tenant options overall. * WithPerTenantOptions replaced by ConfigurePerTenant service collection extensions methods. - -Added support for API and more efficient per-tenant options overall. +* Unique indexes and the UserLogin primary key in the standard Identity models adjusted to include tenant id. +* IMultiTenantContext nullability reworked and should never be null. ### Features