Skip to content

Commit

Permalink
chore: update docs (#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewTriesToCode committed Apr 28, 2024
1 parent 5dd4071 commit 5efd7c8
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 48 deletions.
17 changes: 10 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<TTenantInfo>.
* 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

Expand Down Expand Up @@ -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**!
Expand Down
48 changes: 29 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Current publish feed release:

Table of Contents

1. [What's New in Finbuckle.MultiTenant <span class="_version">7.0.0</span>](#whats-new)
1. [What's New in v<span class="_version">7.0.0</span>](#whats-new)
2. [Quick Start](#quick-start)
3. [Documentation](#documentation)
4. [Sample Projects](#sample-projects)
Expand All @@ -23,37 +23,47 @@ Table of Contents
10. [Building from Source](#building-from-source)
11. [Running Unit Tests](#running-unit-tests)

## <a name="whats-new"></a> What's New in Finbuckle.MultiTenant <span class="_version">7.0.0</span>
## <a name="whats-new"></a> What's New in v<span class="_version">7.0.0</span>

<!--_release-notes-->
> This section only lists release update details specific to v<span class="_version">7.0.0</span>. See
> the [changelog file](CHANGELOG.md) for all release update details.
<!--_release-notes-->

### ⚠ 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<TTenantInfo>.
* 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))
<!--_release-notes-->
* 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.
<!--_release-notes-->

## Quick Start

Expand Down
12 changes: 8 additions & 4 deletions docs/ConfigurationAndUsage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>` 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<TTeenantInfo>` are available via dependency injection
and behave similar to `IHttpContextAccessor`. Internally an `AsyncLocal<T>` 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<TTenantInfo>` 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<TTenantInfo>` 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
Expand Down
23 changes: 13 additions & 10 deletions docs/History.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<TTenantInfo>.
* 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

Expand All @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 ****!
Expand Down
2 changes: 1 addition & 1 deletion docs/Index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Introduction](Introduction)

[What's New in Finbuckle.MultiTenant <span class="_version">7.0.0</span>](WhatsNew)
[What's New in v<span class="_version">7.0.0</span>](WhatsNew)

[Version History](History)

Expand Down
19 changes: 12 additions & 7 deletions docs/WhatsNew.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# What's New in Finbuckle.MultiTenant <span class="_version">7.0.0</span>
# What's New in v<span class="_version">7.0.0</span>

> This page only lists release update details specific to v<span class="_version">7.0.0</span>. [Release update details for all releases are shown in the history page.](History)
<!--_release-notes-->
## [7.0.0](https://github.com/Finbuckle/Finbuckle.MultiTenant/compare/v6.13.1...v7.0.0) (2024-04-21)


### ⚠ 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<TTenantInfo>.
* 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

Expand Down

0 comments on commit 5efd7c8

Please sign in to comment.