CodEaisy.TinySaas
1.0.0-rc3
See the version list below for details.
dotnet add package CodEaisy.TinySaas --version 1.0.0-rc3
NuGet\Install-Package CodEaisy.TinySaas -Version 1.0.0-rc3
<PackageReference Include="CodEaisy.TinySaas" Version="1.0.0-rc3" />
paket add CodEaisy.TinySaas --version 1.0.0-rc3
#r "nuget: CodEaisy.TinySaas, 1.0.0-rc3"
// Install CodEaisy.TinySaas as a Cake Addin #addin nuget:?package=CodEaisy.TinySaas&version=1.0.0-rc3&prerelease // Install CodEaisy.TinySaas as a Cake Tool #tool nuget:?package=CodEaisy.TinySaas&version=1.0.0-rc3&prerelease
TinySaas
TinySaas is a C# library for building multitenant applications with .NET Core 3.0+
Supported Use Cases
- Per-Tenant Services
- Shared Tenant Services
- Schema per Tenant (Data Isolation)
- Database per Tenant (Data Isolation)
- Shared Database (Data Isolation)
Quickstart
- Add dependency to CodEaisy.TinySaas from Nuget
dotnet add package CodEaisy.TinySaas --version 1.0.0-rc3
In
Startup.cs
, add the following inside theConfigureServices
method.public void ConfigureServices(IServiceCollection services) { // register all global singleton services here, and also dependencies for your TenantStore and ResolutionStrategy if any // ... // OPTION 1 services.AddMultiTenancy<Tenant, TenantStore<Tenant>, ResolutionStrategy>(); // OPTION 2 // uses default `CodEaisy.TinySaas.Model.TinyTenant` as tenant model services.AddMultiTenancy<TenantStore<TinyTenant>, TenantResolutionStrategy>(); // ... // services.AddControllers(); }
NB: Option 1 -
Tenant
must implementCodEaisy.TinySaas.Interface.ITenant
TenantStore
andTenantResolutionStrategy
must implementCodEaisy.TinySaas.Interface.ITenantStore
andCodEaisy.TinySaas.Interface.ITenantResolutionStrategy
respectively.Then, add the following in the
Configure
methodpublic void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // enable multitenant support, with missing tenant handler and tenant container // OPTION 1 // missing tenant handler has a dependency that can be provided immediately app.UseMultitenancy<Tenant, MissingTenantHandler, MissingTenantOptions>(missingTenantOptions); // OPTION 2 // missing tenant handler does not have a dependency or dependency is already registered in services app.UseMultitenancy<Tenant, MissingTenantHandler>(); // OPTION 3 // Use `SimpleTenant` as tenant model, and missing tenant handler does not have a dependency or dependency is already registered in services app.UseMultitenancy<TMissingTenantHandler>() // ... }
In
Program.cs
, add the following in theCreateHostBuilder
method.public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); }) // OPTION 1: add multitenant support via TenantStartup class .ConfigureMultiTenancy<TenantStartup, Tenant>(); // OPTION 2: add multitenant support via static method .ConfigureMultiTenancy<Tenant>(ClassName.StaticMethodName);
NB:
TenantStartup
must implementIMultiTenantStartup
ClassName.StaticMethodName
must be of typeSystem.Action<TTenant, Autofac.ContainerBuilder>
whereTTenant
implementsITenant
Requirements
ASP.NET Core 3.0+
Changelog
Learn about the latest improvements.
Credits
Gunnar Peipman and Michael McKenna for their awesome works on Saas in ASP.NET Core.
Want to help ?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues in the hotlist: community-help.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Autofac (>= 5.2.0)
- Autofac.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.AspNetCore.Authentication.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Authentication.Core (>= 2.2.0)
- Microsoft.AspNetCore.Authorization (>= 3.1.4)
- Microsoft.AspNetCore.Diagnostics.HealthChecks (>= 2.2.0)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.AspNetCore.Routing (>= 2.2.2)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 3.1.4)
- Microsoft.Extensions.Hosting (>= 3.1.4)
- Microsoft.Extensions.Options (>= 3.1.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CodEaisy.TinySaas:
Package | Downloads |
---|---|
CodEaisy.TinySaas.AspNetCore
TinySaas ASP.NET Core extension library |
GitHub repositories
This package is not used by any popular GitHub repositories.