MVC 3 多租户架构的灵活动态路由
我想创建一个多租户网站,每个租户都可以创建多个门户 与 Dotnetnuke 的做法类似。 我想提供一个灵活的动态路由(可以在运行时生效,例如 我可以在运行时添加租户),如下所述。 我还喜欢允许/限制租户使用某些模块(区域(控制器组) 用于粗粒度访问控制或用于细粒度访问控制的控制器)和 控制器 实现最佳访问控制的操作。
租户不拥有域或子域 - 使用 SaaS 主机域名)
tenant1.saasplatform.com(隐式意味着具有 /portal0 后缀) 租户1.saasplatform.com/portal0 租户1.saasplatform.com/portal1 saasplatform.com/tenant1 (隐式意味着具有 /portal0 后缀) saasplatform.com/tenant1/portal0 saasplatform.com/tenant1/portal1
租户拥有域或子域)
tenant1.com(隐式表示具有 /portal0 后缀) tenant1.com/portal0 tenant1.com/portal0 tenant1.com(隐式意味着有portal0.前缀) Portal0.tenant1.com Portal1.tenant1.com
给定各种组合,我想根据每个租户的配置提取租户密钥。 我还想提取门户编号(它可以是门户的唯一编号或唯一名称)。
门户号码之后的所有内容都将通过正常路由值解析 {controller}/{action}
tenant1.com[/portal0]
可选和中括号内的“[]”内容它将被视为“portal0”
{tenantkey}{portal0}
tenant1.saasplatform.com[/portal0]
{tenantkey}.saasplatform.com}{portal0}
{tenantkey}.othersaasplatform.com}{portal0}
[portal0.]tenant1.com
{portalkey}.{tenantkey}
下面显示一些好主意。这篇文章很老了。我想知道 MVC 3 是否有新内容?
http://blog.maartenballiauw.be/帖子/2009/05/20/ASPNET-MVC-Domain-Routing.aspx
I want to create a multitenant web site where each tenant can create multiple portals
similar to what Dotnetnuke does.
I want to provide a flexible dynamic routing (that can take effect at run-time e.g.
I can add a tenant at run time) like outlined below.
I also like to allow/restrict tenants to certain modules (Areas(group of Controllers)
for coarse grained access control or Controllers for fine grained access control ) and
Controllers Actions for the finest access control.
Tenant doesn't own a domain or subdomain - uses SaaS host domain name)
tenant1.saasplatform.com ( implicitly means has /portal0 suffix ) tenant1.saasplatform.com/portal0 tenant1.saasplatform.com/portal1 saasplatform.com/tenant1 ( implicitly means has /portal0 suffix ) saasplatform.com/tenant1/portal0 saasplatform.com/tenant1/portal1
Tenant owns a domain or subdomain)
tenant1.com ( implicitly means has /portal0 suffix ) tenant1.com/portal0 tenant1.com/portal0 tenant1.com ( implicitly means has portal0. prefix ) portal0.tenant1.com portal1.tenant1.com
Given various combination I want to extract tenantkey based on configuration per tenant.
I want also to extract portal number (it can be a unique number for a portal or a unique name).
Everything after portal number will be resolved via normal routing values {controller}/{action}
tenant1.com[/portal0]
"[]" content inside the brackets in optional and it will be treated as "portal0"
{tenantkey}{portal0}
tenant1.saasplatform.com[/portal0]
{tenantkey}.saasplatform.com}{portal0}
{tenantkey}.othersaasplatform.com}{portal0}
[portal0.]tenant1.com
{portalkey}.{tenantkey}
Some good ideas shown below. The article is quite old. I was wondering if there is something new in MVC 3?
http://blog.maartenballiauw.be/post/2009/05/20/ASPNET-MVC-Domain-Routing.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果每个门户的内容都是从数据库中获取的,那么最好的选择是挂钩到一个可扩展点。
http://www.simple-talk.com/content/article.aspx ?文章=1358
If the content of each portal is fetched from a database, your best bet is to hook to an extensibility point.
http://www.simple-talk.com/content/article.aspx?article=1358