Multi-tenancy allows multiple users to share resources while keeping their data separate. In a multi-tenant application, customization is provided for each user group (tenants), while the core functionality remains the same.
How we should handle this situation? well, it's easy! Just need to know, the current request is for which tenant, done!
In this video, I've tried to address two issues that you should be aware of:
Not using IHttpContextAccessor
Correct way of config entities in the OnModelCreating method
Repo: https://github.com/sa-es-ir/youtube-s...
Moments
00:00 - Intro
00:20 - Codebase
01:44 - Tenant Provider and Middleware
04:40 - Run the project
05:35 - How OnModelCreating works?
07:28 - Bad practice for setting TenantId
10:53 - Solve the issue for TenantId
15:01 - Why not use IHttpContextAccessor
#aspnetcore #dotnet #multitenants #middlewares
----------------------------------------------------
LinkedIn Profile:
/ sa-es-ir