make builds deterministic and set latest GH actions (#889) (d82f89d)
BREAKING CHANGES
OnTenantResolved and OnTenantNotResolved are no longer used. Use the OnStrategyResolveCompleted, OnStoreResolveCompleted, and OnTenantResolveCompleted events instead.
MultiTenantDbContext constructors accepting ITenantInfo removed, use MultiTenantDbContext.Create factory
method* MultiTenantDbContext constructors accepting ITenantInfo removed, use MultiTenantDbContext.Create factory method instead.
net6.0 and net7.0 are no longer supported targets.
dotnet runtime specific dependencies now float to the latest patch version and are locked at release time with a NuGet lock file. This is a security mitigation and may break some builds not on the latest SDKs.
strategies return null on invalid context type (#885) (9834575)
BREAKING CHANGES
This commit brings the release into alignment with the new version policy. See #887 for details.
Included strategies for ASP.NET Core would throw an exception if the passed context was not an HttpContext type. Now they will return null indicating no identifier was found.
(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.
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.
Removed support for .NET Core 2.1 which ended Microsoft support in August 2020.
Retargeted specifically to .netcoreapp3.1 and .net5.0 across all packages.
Added AdjustKey, AdjustIndex, AdjustAlIndexes, AdjustUniqueIndexes methods to be chained off IsMultiTenant in EFCore functionality. They add the implicit TenantId to the respective key/indexes.
Reverted generic version of IsMultiTenant back to non-generic version for more flexibility.
Improved tenant resolution logging functionality and performance. Thanks to ****!
Fixed a bug with InMemoryStore implementation of TryUpdate. Thanks to ****!
Fixed a bug where ConfigurationStore would throw an exception if there was no default section in the config.
Fixed a bug where ASP.NET Core Identity security stamp validation would force user logout and raise exceptions. Thanks to **** for finding the root cause of this bug.
Fixed a bug where MultiTenantOptionsManager<TOptions> was internal instead of public.
Fixed problematic references in sample projects.
Updated and improved documentation.
Updated and improved tests.
Added various project files for .NET Foundation on-boarding.
Customizable TenantInfo. Implement ITenantInfo as needed or use the basic TenantInfo implementation. Should work with most strategies and stores. This was a major overhaul to the library. See docs for more information.
Changed NuGet structure: use Finbuckle.MultiTenant.AspNetCore for web apps and if needed add Finbuckle.MultiTenant.EntityFrameworkCore.
WithPerTenantAuthentication - Adds support for common per-tenant authentication scenarios. See docs for full details.
Multiple strategies and stores can be registered. They will run in the order registered and the first tenant returned by a strategy/store combination is used.
New ClaimStrategy checks for a tenant claim to resolve the tenant.
New SessionStrategy uses a session variable to resolve the tenant.
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 IdentityMultiTenantDbContextthis 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.
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 DelegatingHandlers (i.e. to add authentication headers). Added sample projects for this store. Thanks to ****!
Fixed an exception with OpenIdConnect remote authentication if "state" is not returned from the identity provider. The new behavior will result in no tenant found for the request.
Updated samples.
Updated documentation.
Updated unit tests to check against all valid project targets.
Added support for ASP.NET Core 3! Valid project targets are netcoreapp3.0, netcoreapp2.0, and netcoreapp2.1.
Added a sample app for ASP.NET 3 highlighting the route strategy improvements due to the endpoint routing mechanism.
Fixed a bug where route strategy could throw an exception when used with Razor Pages. Thanks -services!
Support for configuring multiple multitenant strategies. Each will be tried in the order configured until a non-null tenant identifier is returned. The exception is the fallback strategy which always goes last.
Refactored component assemblies for better dependency control. EFCore can be excluded by referencing Finbuckle.MultiTenant.AspNetCore instead of Finbuckle.MultiTenant.
Updated documentation.
Updated unit tests to check against all valid project targets.
Added support for any preexisting global query filters in MultiTenantDbContext and MultiTenantIdentityDbContext. Thanks !
Exposed the inner stores and strategies as a property on the respective StoreInfo and StrategyInfo properties of MultiTenantContext. Previously you could only access the wrapper object for each. Thanks !
Fixed certain methods on MultiTenantOptionsCache to be external as originally intended. Thanks !
Fix a bug with TryUpdateAsync in the wrapper store. Thanks !
Added a strategy wrapper that handles validation and logging for the active strategy. When implementing IMultiTenantStrategy basic validation and logging are automatically provided.
Added the delegate strategy that accepts a lambda to return the tenant identifier. Configure by calling WithDelegateStrategy(...).
Added the fallback strategy that provides a tenant identifier if the normal strategy (or remote authentication, if applicable) fails to resolve a tenant. Configure by calling WithFallbackStrategy(...).
Added TrySetTenantInfo as an extension method to HttpContext. This will set the TenantInfo provided as the current tenant for the request and can optionally reset the service providers so that scoped services are regenerated under the new tenant.
Updated and improved documentation and sample projects.
Miscellaneous bug fixes, code improvement, and unit tests.