ASP.NET MVC 5,实体框架,Ninject和多租户安装 [英] ASP.NET MVC 5, Entity Framework, Ninject and Multi Tenancy Setup

查看:250
本文介绍了ASP.NET MVC 5,实体框架,Ninject和多租户安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种多租户设置为我工作的一个应用程序的最佳方法。当前应用程序是专为篮球,但想用同样的codeBase的足球。

I am trying to find the best approach for a multi tenancy setup for an application I am working on. The current application is specifically for basketball but would like to use the same codebase for football.

该应用程序会改变颜色,图案,和其他一些作品的code和意见可能会被显示或隐藏。这都将基于应用的租户运动使用的URL。

The application would change colors, logo, and some other pieces of code and views might be shown or hidden. This will all be based on the URL of the application for sport tenant to use.

我使用ASP.NET MVC 5,Ninject和实体框架6.我要在我的数据库中存储的URL等相关信息,它创建一个租户表。

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

在应用程序启动时什么是检索租户,并存储该用户的最佳方法是什么?请记住,用户可以浏览到其他体育网站,请保持相同的登录,但将只加载与该租户的信息。将一个cookie是最好的选择吗?我需要一种方法,通过服务层还访问房客。

When the application starts up what is the best way to retrieve the tenant and store it for that user? Keep in mind the user may navigate to the other sport site, keep same login, but would load only the information related to that tenant. Would a cookie be the best bet here? I will need a way to access the tenant through the services layer also.

我可以使用 https://github.com/jbogard/EntityFramework.Filters 为在某些表实体框架过滤不仅关系到体育运动。不过,我怎么能访问TenantID做到这一点?将某种类型的静态工厂工作?

I may use https://github.com/jbogard/EntityFramework.Filters for the Entity Framework filtering on certain tables only related to that sport. However how can I access the TenantID to do this? Would a static factory of some sort work?

推荐答案

您可以看看的 AspNet.Identity ,这样可以让你来验证用户/租户,存储的个人资料信息为每个用户/租户和使用角色或索赔授权的网站的不同部分

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

这篇关于ASP.NET MVC 5,实体框架,Ninject和多租户安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆