ASP.NET MVC 5,实体框架,Ninject和多租户安装

编程入门 行业动态 更新时间:2024-10-28 00:25:24
本文介绍了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.

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

I may use github/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和多租户安装

本文发布于:2023-11-12 13:50:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581678.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:租户   实体   框架   NET   ASP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!