ASP.NET MVC 5, Entity Framework, Ninject and Multi Tenancy Setup

I am trying to find the best approach for setting up multiple tenants for an application I am working on. The current application is specifically for basketball, but would like to use the same codebase for football.

The app will change colors, logo and some other code snippets, and views can be shown or hidden. This will all be based on the app url for the tenant to use.

I am using ASP.NET MVC 5, Ninject, and Entity Framework 6. I am about to create a Tenant table in my database that stores the URL and other related information.

When the app launches, what is the best way to get a tenant and store it for that user? Keep in mind that the user can go to another sports site, keep the same login, but will only download information related to that renter. Will cookie be the best choice here? I will also need access to the tenant through the service layer.

I can use https://github.com/jbogard/EntityFramework.Filters to filter Entity Framework on specific tables related to this sport only. However, how can I access the TenantID to do this? Will a static factory work?

+3


source to share


1 answer


You can look at AspNet.Identity , which will allow you to authenticate users / tenants, store profile information for each user / tenant, and use roles or claims to authorize for different parts of the website.



0


source







All Articles